Class: Archfiend::Logging::JSONFormatter
- Inherits:
-
BaseFormatter
- Object
- BaseFormatter
- Archfiend::Logging::JSONFormatter
- Defined in:
- lib/archfiend/logging/json_formatter.rb
Overview
A JSON log formatter class, returns each entry as a JSON line
Constant Summary
Constants inherited from BaseFormatter
BaseFormatter::SEVERITY_STACK_ENTRIES_COUNT, BaseFormatter::STACK_ENTRIES_TO_SKIP
Instance Method Summary collapse
Instance Method Details
#call(severity, datetime, progname, msg) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/archfiend/logging/json_formatter.rb', line 7 def call(severity, datetime, progname, msg) description, backtrace = description_and_backtrace(severity, msg) log_hash = { '@timestamp': datetime.utc.iso8601(3), loglevel: severity&.downcase, pid: ::Process.pid, tid: tid, type: :archfiend, message: description, backtrace: backtrace, app: progname } Oj.dump(log_hash, mode: :compat) + "\n" end |