Class: LogjamAgent::ConsoleFormatter

Inherits:
Logger::Formatter
  • Object
show all
Defined in:
lib/logjam_agent/buffered_logger.rb

Instance Method Summary collapse

Instance Method Details

#call(severity, timestamp, progname, msg) ⇒ Object

This method is invoked when a log event occurs



7
8
9
# File 'lib/logjam_agent/buffered_logger.rb', line 7

def call(severity, timestamp, progname, msg)
  "[#{format_time(timestamp)}] #{String === msg ? msg : msg.inspect}\n"
end

#format_time(timestamp) ⇒ Object



11
12
13
# File 'lib/logjam_agent/buffered_logger.rb', line 11

def format_time(timestamp)
  timestamp.strftime("%H:%M:%S.#{"%06d" % timestamp.usec}")
end