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

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

Constant Summary

Constants inherited from Base

Base::COLORS

Instance Method Summary collapse

Methods inherited from Base

#format_context, #tid

Instance Method Details

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



71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/sidekiq/logger.rb', line 71

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

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