Sha256: 69ad3214369ae439ac21970967fa22f496fbe4921ace8449a4544220a69ecd1a
Contents?: true
Size: 1 KB
Versions: 5
Compression:
Stored size: 1 KB
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?(Integer) ? 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
5 entries across 5 versions & 3 rubygems