Class: Contrast::Logger::Format

Inherits:
Ougai::Formatters::Bunyan
  • Object
show all
Defined in:
lib/contrast/logger/format.rb

Overview

Our format for the Ougai logger allowing for custom log format that extends the behavior of the default Ougai logger

Constant Summary collapse

NO_REQUEST_HASH =
{ request_id: -1 }.cs__freeze
LOG_TRACKER =
Contrast::Utils::ThreadTracker.new

Instance Method Summary collapse

Instance Method Details

#_call(severity, time, progname, data) ⇒ Object

Our override of the _call method to add in the extra data that we want, based on github.com/tilfin/ougai/blob/1fe4fc2587be8eabc47d36dc57ee2814f8a0162b/lib/ougai/formatters/bunyan.rb#L26 By default, it adds:

name: progname || @app_name,
hostname: @hostname,
pid: $$,
level: to_level(severity),
time: time,
v: 0

and we add the fields from #format_hash



26
27
28
29
30
31
32
# File 'lib/contrast/logger/format.rb', line 26

def _call severity, time, progname, data
  super(severity,
        time,
        progname,
        format_hash.merge(data)
  )
end