Class: Logger::Formatter

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

Overview

Default formatter for log messages.

Constant Summary collapse

Format =
"%s, [%s#%d] %5s -- %s: %s\n"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeFormatter

Returns a new instance of Formatter


501
502
503
# File 'lib/logger.rb', line 501

def initialize
  @datetime_format = nil
end

Instance Attribute Details

#datetime_formatObject

Returns the value of attribute datetime_format


499
500
501
# File 'lib/logger.rb', line 499

def datetime_format
  @datetime_format
end

Instance Method Details

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


505
506
507
508
# File 'lib/logger.rb', line 505

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