Class: LogUtils::Logger
- Inherits:
-
Object
- Object
- LogUtils::Logger
- Includes:
- Level
- Defined in:
- lib/logutils/logger.rb
Constant Summary
Constants included from Level
LogUtils::Level::DEBUG, LogUtils::Level::ERROR, LogUtils::Level::FATAL, LogUtils::Level::INFO, LogUtils::Level::WARN
Instance Attribute Summary collapse
-
#listeners ⇒ Object
readonly
Returns the value of attribute listeners.
Instance Method Summary collapse
- #debug(msg) ⇒ Object
- #error(msg) ⇒ Object
- #fatal(msg) ⇒ Object
- #info(msg) ⇒ Object
-
#initialize ⇒ Logger
constructor
A new instance of Logger.
- #warn(msg) ⇒ Object
Constructor Details
#initialize ⇒ Logger
Returns a new instance of Logger.
70 71 72 73 |
# File 'lib/logutils/logger.rb', line 70 def initialize @listeners = [] @listeners << STDLISTENER # by default log to console end |
Instance Attribute Details
#listeners ⇒ Object (readonly)
Returns the value of attribute listeners.
75 76 77 |
# File 'lib/logutils/logger.rb', line 75 def listeners @listeners end |
Instance Method Details
#debug(msg) ⇒ Object
77 78 79 |
# File 'lib/logutils/logger.rb', line 77 def debug( msg ) write( Event.new( DEBUG, msg ) ) end |
#error(msg) ⇒ Object
89 90 91 |
# File 'lib/logutils/logger.rb', line 89 def error( msg ) write( Event.new( ERROR, msg ) ) end |
#fatal(msg) ⇒ Object
93 94 95 |
# File 'lib/logutils/logger.rb', line 93 def fatal( msg ) write( Event.new( FATAL, msg ) ) end |