class Amazon::Coral::WrappedLogger
Wraps Ruby’s built in Logger to prepend a context string to log messages. This is useful to prefix log messages with the name of the originating class, etc.
Public Class Methods
new(key, logger)
click to toggle source
# File lib/amazon/coral/simplelog.rb, line 13 def initialize(key, logger) @key = key @logger = logger end
Public Instance Methods
debug(s)
click to toggle source
# File lib/amazon/coral/simplelog.rb, line 18 def debug(s) @logger.debug(format(s)) end
debug?()
click to toggle source
# File lib/amazon/coral/simplelog.rb, line 34 def debug? @logger.debug? end
error(s)
click to toggle source
# File lib/amazon/coral/simplelog.rb, line 27 def error(s) @logger.error(format(s)) end
error?()
click to toggle source
# File lib/amazon/coral/simplelog.rb, line 43 def error? @logger.error? end
fatal(s)
click to toggle source
# File lib/amazon/coral/simplelog.rb, line 30 def fatal(s) @logger.fatal(format(s)) end
fatal?()
click to toggle source
# File lib/amazon/coral/simplelog.rb, line 46 def fatal? @logger.fatal? end
format(s)
click to toggle source
# File lib/amazon/coral/simplelog.rb, line 50 def format(s) return "#{@key}: #{s}" end
info(s)
click to toggle source
# File lib/amazon/coral/simplelog.rb, line 21 def info(s) @logger.info(format(s)) end
info?()
click to toggle source
# File lib/amazon/coral/simplelog.rb, line 37 def info? @logger.info? end
warn(s)
click to toggle source
# File lib/amazon/coral/simplelog.rb, line 24 def warn(s) @logger.warn(format(s)) end
warn?()
click to toggle source
# File lib/amazon/coral/simplelog.rb, line 40 def warn? @logger.warn? end