class Lumberjack::LogEntry
An entry in a log is a data structure that captures the log message as well as information about the system that logged the message.
Constants
- TIME_FORMAT
Attributes
message[RW]
pid[RW]
progname[RW]
severity[RW]
time[RW]
unit_of_work_id[RW]
Public Class Methods
new(time, severity, message, progname, pid, unit_of_work_id)
click to toggle source
# File lib/lumberjack/log_entry.rb, line 9 def initialize(time, severity, message, progname, pid, unit_of_work_id) @time = time @severity = (severity.is_a?(Fixnum) ? severity : Severity.label_to_level(severity)) @message = message @progname = progname @pid = pid @unit_of_work_id = unit_of_work_id end
Public Instance Methods
inspect()
click to toggle source
# File lib/lumberjack/log_entry.rb, line 32 def inspect to_s end
severity_label()
click to toggle source
# File lib/lumberjack/log_entry.rb, line 18 def severity_label Severity.level_to_label(severity) end
to_s()
click to toggle source
# File lib/lumberjack/log_entry.rb, line 22 def to_s buf = "[#{time.strftime(TIME_FORMAT)}.#{(time.usec / 1000.0).round.to_s.rjust(3, '0')} #{severity_label} #{progname}(#{pid})" if unit_of_work_id buf << " #" buf << unit_of_work_id end buf << "] " buf << message end