Cinch::Logger::ZcbotLogger

This logger logs all incoming messages in the format of zcbot. All other debug output (outgoing messages, exceptions, ...) will silently be dropped. The sole purpose of this logger is to produce logs parseable by pisg (with the zcbot formatter) to create channel statistics..

Public Class Methods

new(output = STDERR) click to toggle source

@param [IO] output An IO to log to.

# File lib/cinch/logger/zcbot_logger.rb, line 11
def initialize(output = STDERR)
  @output = output
  @mutex = Mutex.new
end

Public Instance Methods

debug(messages) click to toggle source

(see Logger::Logger#debug)

# File lib/cinch/logger/zcbot_logger.rb, line 17
def debug(messages)
end
log(messages, kind = :generic) click to toggle source

(see Logger::Logger#log)

# File lib/cinch/logger/zcbot_logger.rb, line 21
def log(messages, kind = :generic)
  return if kind != :incoming

  @mutex.synchronize do
    messages = [messages].flatten.map {|s| s.to_s.chomp}
    messages.each do |msg|
      @output.puts Time.now.strftime("%m/%d/%Y %H:%M:%S ") + msg.encode("locale", {:invalid => :replace, :undef => :replace})
    end
  end
end
log_exception(e) click to toggle source

(see Logger::Logger#log_exception)

# File lib/cinch/logger/zcbot_logger.rb, line 33
def log_exception(e)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.