Class: MLogger::Formatter

Inherits:
Object
  • Object
show all
Defined in:
lib/mlogger.rb

Overview

Default formatter for log messages

Constant Summary collapse

Format =
"%s PID:%d %5s %s: %s\n"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeFormatter

Returns a new instance of Formatter.



452
453
454
# File 'lib/mlogger.rb', line 452

def initialize
  @datetime_format = nil
end

Instance Attribute Details

#datetime_formatObject

Returns the value of attribute datetime_format.



450
451
452
# File 'lib/mlogger.rb', line 450

def datetime_format
  @datetime_format
end

Instance Method Details

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



456
457
458
459
# File 'lib/mlogger.rb', line 456

def call(severity, time, progname, msg)
  Format % [format_datetime(time), $$, severity, progname,
            msg2str(msg)]
end