Class: Logger::Formatter
- Inherits:
-
Object
- Object
- Logger::Formatter
- Defined in:
- lib/logger/formatter.rb
Overview
Default formatter for log messages.
Constant Summary collapse
- Format =
"%.1s, [%s #%d] %5s -- %s: %s\n"
- DatetimeFormat =
"%Y-%m-%dT%H:%M:%S.%6N"
Instance Attribute Summary collapse
-
#datetime_format ⇒ Object
Returns the value of attribute datetime_format.
Instance Method Summary collapse
- #call(severity, time, progname, msg) ⇒ Object
-
#initialize ⇒ Formatter
constructor
A new instance of Formatter.
Constructor Details
#initialize ⇒ Formatter
Returns a new instance of Formatter.
11 12 13 |
# File 'lib/logger/formatter.rb', line 11 def initialize @datetime_format = nil end |
Instance Attribute Details
#datetime_format ⇒ Object
Returns the value of attribute datetime_format.
9 10 11 |
# File 'lib/logger/formatter.rb', line 9 def datetime_format @datetime_format end |
Instance Method Details
#call(severity, time, progname, msg) ⇒ Object
15 16 17 |
# File 'lib/logger/formatter.rb', line 15 def call(severity, time, progname, msg) sprintf(Format, severity, format_datetime(time), Process.pid, severity, progname, msg2str(msg)) end |