Module: JsonTaggedLogging::Formatter
- Includes:
- ActiveSupport::TaggedLogging::Formatter
- Defined in:
- lib/json_tagged_logging/formatter.rb
Overview
:nodoc:
Constant Summary collapse
- RESERVED_FIELDS =
%i[level timestamp app message trace]
Instance Method Summary collapse
Instance Method Details
#call(severity, timestamp, progname, msg) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/json_tagged_logging/formatter.rb', line 10 def call(severity, , progname, msg) = .except(*RESERVED_FIELDS) log = { level: severity, timestamp: .utc, app: progname } log.merge!((msg)) log.merge!() Oj.dump(log, mode: :compat) + "\n" end |
#tags_hash ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/json_tagged_logging/formatter.rb', line 25 def = .inject do |memo, value| value.is_a?(Hash) ? memo.merge(value) : memo end .is_a?(Hash) ? : {} end |