Class: StrftimeLogger::Formatter
- Inherits:
-
Object
- Object
- StrftimeLogger::Formatter
- Defined in:
- lib/strftime_logger/formatter.rb
Constant Summary collapse
- FORMAT =
"%s [%s] %s\n"- LEVEL_TEXT =
%w(DEBUG INFO WARN ERROR FATAL UNKNOWN)
Instance Method Summary collapse
- #call(severity, message = nil, &block) ⇒ Object
-
#initialize(opts = {}) ⇒ Formatter
constructor
A new instance of Formatter.
Constructor Details
#initialize(opts = {}) ⇒ Formatter
Returns a new instance of Formatter.
8 9 |
# File 'lib/strftime_logger/formatter.rb', line 8 def initialize(opts={}) end |
Instance Method Details
#call(severity, message = nil, &block) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/strftime_logger/formatter.rb', line 11 def call(severity, = nil, &block) if .nil? if block_given? = yield else = "" end end if severity.nil? () + "\n" else FORMAT % [format_datetime(Time.now), format_severity(severity), ()] end end |