Class: Coralogix::DebugLogger

Inherits:
Object
  • Object
show all
Defined in:
lib/debug_logger.rb

Class Method Summary collapse

Class Method Details

.debug_mode=(value) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/debug_logger.rb', line 38

def self.debug_mode=(value)
    begin
        @enabled = value
        if value
            @logger = Logger.new("/tmp/#{LOG_FILE_NAME}", 1, 10485760)
        else
            if @external == false
                @logger.close unless @logger == nil
                @logger = nil
            end
        end
    rescue Exception => e
        if @enabled  
            puts e.message  
            puts e.backtrace.inspect  
        end
    end
end

.debug_mode?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/debug_logger.rb', line 34

def self.debug_mode?
    @enabled
end

.enabled=(value) ⇒ Object



22
23
24
# File 'lib/debug_logger.rb', line 22

def self.enabled=(value)
    @enabled = value
end

.external=(value) ⇒ Object



26
27
28
# File 'lib/debug_logger.rb', line 26

def self.external=(value)
    @external = value
end

.initializeObject

attr_accessor :external, :enabled, :logger



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/debug_logger.rb', line 9

def self.initialize
    begin
        @mutex = Mutex.new
        @enabled = false
        @external = false
    rescue Exception => e
        if @enabled 
            puts e.message  
            puts e.backtrace.inspect  
        end
    end
end

.logger=(value) ⇒ Object



30
31
32
# File 'lib/debug_logger.rb', line 30

def self.logger=(value)
    @logger = value
end