class Pione::Log::DelegatableLogger
DelegatableLogger
delegates logging functions to another logger.
Public Class Methods
new(logger)
click to toggle source
Calls superclass method
Pione::Log::BasicLogger::new
# File lib/pione/log/system-log.rb, line 123 def initialize(logger) super() @logger = logger end
Public Instance Methods
debug(msg, pos=caller(1).first, pid=Process.pid)
click to toggle source
# File lib/pione/log/system-log.rb, line 145 def debug(msg, pos=caller(1).first, pid=Process.pid) send_message(:debug, msg, pos, pid) {@logger.debug(msg, pos, pid)} end
error(msg, pos=caller(1).first, pid=Process.pid)
click to toggle source
# File lib/pione/log/system-log.rb, line 133 def error(msg, pos=caller(1).first, pid=Process.pid) send_message(:error, msg, pos, pid) {@logger.error(msg, pos, pid)} end
fatal(msg, pos=caller(1).first, pid=Process.pid)
click to toggle source
# File lib/pione/log/system-log.rb, line 129 def fatal(msg, pos=caller(1).first, pid=Process.pid) send_message(:fatal, msg, pos, pid) {@logger.fatal(msg, pos, pid)} end
info(msg, pos=caller(1).first, pid=Process.pid)
click to toggle source
# File lib/pione/log/system-log.rb, line 141 def info(msg, pos=caller(1).first, pid=Process.pid) send_message(:info, msg, pos, pid) {@logger.info(msg, pos, pid)} end
terminate()
click to toggle source
# File lib/pione/log/system-log.rb, line 149 def terminate @logger = nil end
warn(msg, pos=caller(1).first, pid=Process.pid)
click to toggle source
# File lib/pione/log/system-log.rb, line 137 def warn(msg, pos=caller(1).first, pid=Process.pid) send_message(:warn, msg, pos, pid) {@logger.warn(msg, pos, pid)} end
Private Instance Methods
send_message(level, msg, pos, pid, &block)
click to toggle source
# File lib/pione/log/system-log.rb, line 155 def send_message(level, msg, pos, pid, &block) if loggable?(level) begin block.call rescue Exception # print stdout directly if the logger fails $stdout.puts("%s (%s) #%s" % [msg, pos, pid]) end end end