Class: Gub::Logger

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeLogger

Returns a new instance of Logger.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/gub/logger.rb', line 7

def initialize
  self.log = ::Logger.new(STDOUT)
  if Gub.debug
    self.log.level = ::Logger::DEBUG
  else
    self.log.level = ::Logger::INFO
  end
  self.log.formatter = proc do |severity, datetime, progname, msg|
    if ['INFO'].include?(severity)
      "#{msg}\n"
    elsif ['FATAL'].include?(severity)
        "#{severity}: #{msg}\n"
    else
      "#{severity} #{progname} #{datetime}: #{msg}\n"
    end
  end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args, &block) ⇒ Object



28
29
30
# File 'lib/gub/logger.rb', line 28

def method_missing meth, *args, &block
  self.log.send(meth, *args, &block)
end

Instance Attribute Details

#logObject

Returns the value of attribute log.



5
6
7
# File 'lib/gub/logger.rb', line 5

def log
  @log
end

Instance Method Details

#start_debuggingObject



25
26
# File 'lib/gub/logger.rb', line 25

def start_debugging
end