Class: CopyTunerClient::PrefixedLogger

Inherits:
Object
  • Object
show all
Defined in:
lib/copy_tuner_client/prefixed_logger.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(prefix, logger) ⇒ PrefixedLogger

Returns a new instance of PrefixedLogger.



5
6
7
8
# File 'lib/copy_tuner_client/prefixed_logger.rb', line 5

def initialize(prefix, logger)
  @prefix          = prefix
  @original_logger = logger
end

Instance Attribute Details

#original_loggerObject (readonly)

Returns the value of attribute original_logger.



3
4
5
# File 'lib/copy_tuner_client/prefixed_logger.rb', line 3

def original_logger
  @original_logger
end

#prefixObject (readonly)

Returns the value of attribute prefix.



3
4
5
# File 'lib/copy_tuner_client/prefixed_logger.rb', line 3

def prefix
  @prefix
end

Instance Method Details

#debug(message = nil, &block) ⇒ Object



14
15
16
# File 'lib/copy_tuner_client/prefixed_logger.rb', line 14

def debug(message = nil, &block)
  log(:debug, message, &block)
end

#error(message = nil, &block) ⇒ Object



22
23
24
# File 'lib/copy_tuner_client/prefixed_logger.rb', line 22

def error(message = nil, &block)
  log(:error, message, &block)
end

#fatal(message = nil, &block) ⇒ Object



26
27
28
# File 'lib/copy_tuner_client/prefixed_logger.rb', line 26

def fatal(message = nil, &block)
  log(:fatal, message, &block)
end

#flushObject



30
31
32
# File 'lib/copy_tuner_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/copy_tuner_client/prefixed_logger.rb', line 10

def info(message = nil, &block)
  log(:info, message, &block)
end

#warn(message = nil, &block) ⇒ Object



18
19
20
# File 'lib/copy_tuner_client/prefixed_logger.rb', line 18

def warn(message = nil, &block)
  log(:warn, message, &block)
end