Module: Birling::Formatter
- Defined in:
- lib/birling/formatter.rb
Constant Summary collapse
- TIME_FORMAT_DEFAULT =
Constants ============================================================
'%Y-%m-%d %H:%M:%S'.freeze
Class Method Summary collapse
-
.call(severity, time, program, message) ⇒ Object
Implementation for a plug-in Logger formatter.
-
.time_format(time) ⇒ Object
Default time formatter method.
Class Method Details
.call(severity, time, program, message) ⇒ Object
Implementation for a plug-in Logger formatter.
16 17 18 19 20 21 22 |
# File 'lib/birling/formatter.rb', line 16 def self.call(severity, time, program, ) if (program) "[#{time.strftime(TIME_FORMAT_DEFAULT)}] <#{program}> #{}\n" else "[#{time.strftime(TIME_FORMAT_DEFAULT)}] #{}\n" end end |
.time_format(time) ⇒ Object
Default time formatter method.
11 12 13 |
# File 'lib/birling/formatter.rb', line 11 def self.time_format(time) (time || Time.now).strftime(TIME_FORMAT_DEFAULT) end |