Class: Gub::Logger
- Inherits:
-
Object
- Object
- Gub::Logger
- Defined in:
- lib/gub/logger.rb
Instance Attribute Summary collapse
-
#log ⇒ Object
Returns the value of attribute log.
Instance Method Summary collapse
-
#initialize ⇒ Logger
constructor
A new instance of Logger.
- #method_missing(meth, *args, &block) ⇒ Object
- #start_debugging ⇒ Object
Constructor Details
#initialize ⇒ Logger
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
#log ⇒ Object
Returns the value of attribute log.
5 6 7 |
# File 'lib/gub/logger.rb', line 5 def log @log end |
Instance Method Details
#start_debugging ⇒ Object
25 26 |
# File 'lib/gub/logger.rb', line 25 def start_debugging end |