Class: Logger::SyslogFormatter
- Inherits:
-
Formatter
- Object
- Formatter
- Logger::SyslogFormatter
- Defined in:
- lib/syslog-formatter.rb
Overview
Adds some default information to syslog messages. Log format:
[Time.mSec] [SeverityLabel]: message
Constant Summary collapse
- Format =
"[%s] [%5s]: %s\n"
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 ⇒ SyslogFormatter
constructor
A new instance of SyslogFormatter.
Constructor Details
#initialize ⇒ SyslogFormatter
Returns a new instance of SyslogFormatter.
10 11 12 |
# File 'lib/syslog-formatter.rb', line 10 def initialize @datetime_format = nil end |
Instance Attribute Details
#datetime_format ⇒ Object
Returns the value of attribute datetime_format.
8 9 10 |
# File 'lib/syslog-formatter.rb', line 8 def datetime_format @datetime_format end |
Instance Method Details
#call(severity, time, progname, msg) ⇒ Object
14 15 16 |
# File 'lib/syslog-formatter.rb', line 14 def call(severity, time, progname, msg) Format % [format_datetime(time), severity, msg2str(msg)] end |