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



115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/sidekiq/logger.rb', line 115

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