Class: CopycopterClient::PrefixedLogger
- Inherits:
-
Object
- Object
- CopycopterClient::PrefixedLogger
- Defined in:
- lib/copycopter_client/prefixed_logger.rb
Instance Attribute Summary collapse
-
#original_logger ⇒ Object
readonly
Returns the value of attribute original_logger.
-
#prefix ⇒ Object
readonly
Returns the value of attribute prefix.
Instance Method Summary collapse
- #debug(message = nil, &block) ⇒ Object
- #error(message = nil, &block) ⇒ Object
- #fatal(message = nil, &block) ⇒ Object
- #flush ⇒ Object
- #info(message = nil, &block) ⇒ Object
-
#initialize(prefix, logger) ⇒ PrefixedLogger
constructor
A new instance of PrefixedLogger.
- #warn(message = nil, &block) ⇒ Object
Constructor Details
#initialize(prefix, logger) ⇒ PrefixedLogger
Returns a new instance of PrefixedLogger.
5 6 7 8 |
# File 'lib/copycopter_client/prefixed_logger.rb', line 5 def initialize(prefix, logger) @prefix = prefix @original_logger = logger end |
Instance Attribute Details
#original_logger ⇒ Object (readonly)
Returns the value of attribute original_logger.
3 4 5 |
# File 'lib/copycopter_client/prefixed_logger.rb', line 3 def original_logger @original_logger end |
#prefix ⇒ Object (readonly)
Returns the value of attribute prefix.
3 4 5 |
# File 'lib/copycopter_client/prefixed_logger.rb', line 3 def prefix @prefix end |
Instance Method Details
#debug(message = nil, &block) ⇒ Object
14 15 16 |
# File 'lib/copycopter_client/prefixed_logger.rb', line 14 def debug( = nil, &block) log(:debug, , &block) end |
#error(message = nil, &block) ⇒ Object
22 23 24 |
# File 'lib/copycopter_client/prefixed_logger.rb', line 22 def error( = nil, &block) log(:error, , &block) end |
#fatal(message = nil, &block) ⇒ Object
26 27 28 |
# File 'lib/copycopter_client/prefixed_logger.rb', line 26 def fatal( = nil, &block) log(:fatal, , &block) end |
#flush ⇒ Object
30 31 32 |
# File 'lib/copycopter_client/prefixed_logger.rb', line 30 def flush original_logger.flush if original_logger.respond_to?(:flush) end |
#info(message = nil, &block) ⇒ Object
10 11 12 |
# File 'lib/copycopter_client/prefixed_logger.rb', line 10 def info( = nil, &block) log(:info, , &block) end |
#warn(message = nil, &block) ⇒ Object
18 19 20 |
# File 'lib/copycopter_client/prefixed_logger.rb', line 18 def warn( = nil, &block) log(:warn, , &block) end |