Class: Logist::Formatter::Json
- Inherits:
-
Logger::Formatter
- Object
- Logger::Formatter
- Logist::Formatter::Json
- Defined in:
- lib/logist/formatter/json.rb
Instance Attribute Summary collapse
-
#flat_json ⇒ Object
Returns the value of attribute flat_json.
Instance Method Summary collapse
Instance Attribute Details
#flat_json ⇒ Object
Returns the value of attribute flat_json.
8 9 10 |
# File 'lib/logist/formatter/json.rb', line 8 def flat_json @flat_json end |
Instance Method Details
#call(severity, timestamp, progname, raw_msg) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/logist/formatter/json.rb', line 10 def call(severity, , progname, raw_msg) msg = (raw_msg) payload = { level: severity, timestamp: format_datetime(), environment: ::Rails.env } if flat_json && msg.is_a?(Hash) payload.merge!(msg) else payload.merge!(message: msg) end payload.to_json << "\n" end |