Sha256: 16f63e79a2b5c6fa0aea60345ffb6b22248301f8ace49f397b52834168bd2ff2
Contents?: true
Size: 1023 Bytes
Versions: 25
Compression:
Stored size: 1023 Bytes
Contents
module Lumberjack # 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. class LogEntry attr_accessor :time, :message, :severity, :progname, :pid, :unit_of_work_id TIME_FORMAT = "%Y-%m-%dT%H:%M:%S".freeze 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 def severity_label Severity.level_to_label(severity) end 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 def inspect to_s end end end
Version data entries
25 entries across 23 versions & 7 rubygems