Class: Workerholic::LogManager
- Inherits:
-
Object
- Object
- Workerholic::LogManager
- Defined in:
- lib/workerholic/log_manager.rb
Instance Attribute Summary collapse
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
Instance Method Summary collapse
- #error(message) ⇒ Object
- #info(message) ⇒ Object
-
#initialize ⇒ LogManager
constructor
A new instance of LogManager.
- #log(severity, message) ⇒ Object
Constructor Details
#initialize ⇒ LogManager
Returns a new instance of LogManager.
5 6 7 |
# File 'lib/workerholic/log_manager.rb', line 5 def initialize @logger = Logger.new(STDOUT) end |
Instance Attribute Details
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
3 4 5 |
# File 'lib/workerholic/log_manager.rb', line 3 def logger @logger end |
Instance Method Details
#error(message) ⇒ Object
13 14 15 |
# File 'lib/workerholic/log_manager.rb', line 13 def error() log('error', ) end |
#info(message) ⇒ Object
9 10 11 |
# File 'lib/workerholic/log_manager.rb', line 9 def info() log('info', ) end |
#log(severity, message) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/workerholic/log_manager.rb', line 17 def log(severity, ) return if $TESTING logger.formatter = proc do |severity, datetime, progname, msg| "#{severity}: #{msg}\n" end logger.send(severity, ) end |