simple centralized logger. outputs to multiple sinks by calling << on them. also keeps a record of all messages, so that adding a new sink will send all previous messages to it by default.
# File lib/sup/logger.rb, line 26 def add_sink s, copy_current=true @mutex.synchronize do @sinks << s s << @buf.string if copy_current end end
# File lib/sup/logger.rb, line 35 def clear!; @mutex.synchronize { @buf = StringIO.new } end
send a message regardless of the current logging level
# File lib/sup/logger.rb, line 46 def force_message m; send_message format_message(nil, Time.now, m) end
# File lib/sup/logger.rb, line 24 def level=(level); @level = LEVELS.index(level) || raise(ArgumentError, "invalid log level #{level.inspect}: should be one of #{LEVELS * ', '}"); end
Generated with the Darkfish Rdoc Generator 2.