Class: Sidekiq::Logger::Formatters::JSON

Inherits:
Base
  • Object
show all
Defined in:
lib/sidekiq/logger.rb

Instance Method Summary collapse

Methods inherited from Base

#ctx, #format_context, #tid

Instance Method Details

#call(severity, time, program_name, message) ⇒ Object


149
150
151
152
153
154
155
156
157
158
159
160
161
# File 'lib/sidekiq/logger.rb', line 149

def call(severity, time, program_name, message)
  hash = {
    ts: time.utc.iso8601(3),
    pid: ::Process.pid,
    tid: tid,
    lvl: severity,
    msg: message,
  }
  c = ctx
  hash["ctx"] = c unless c.empty?

  Sidekiq.dump_json(hash) << "\n"
end