Class: Log::Formatter
- Inherits:
-
Object
- Object
- Log::Formatter
- Defined in:
- lib/pmux/util_logger.rb
Constant Summary collapse
- Format =
"%s %s\n"
Instance Attribute Summary collapse
-
#datetime_format ⇒ Object
Returns the value of attribute datetime_format.
Instance Method Summary collapse
Instance Attribute Details
#datetime_format ⇒ Object
Returns the value of attribute datetime_format.
8 9 10 |
# File 'lib/pmux/util_logger.rb', line 8 def datetime_format @datetime_format end |
Instance Method Details
#call(severity, time, progname, msg) ⇒ Object
10 11 12 13 |
# File 'lib/pmux/util_logger.rb', line 10 def call severity, time, progname, msg tstr = time.strftime("%Y-%m-%d %H:%M:%S") Format % [tstr, msg2str(msg)] end |
#msg2str(msg) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/pmux/util_logger.rb', line 15 def msg2str(msg) case msg when ::String msg when ::Exception "#{ msg. } (#{ msg.class })\n" << (msg.backtrace || []).join("\n") else msg.inspect end end |