class GovukSidekiq::GovukJsonFormatter

Public Instance Methods

call(severity, time, _, message) click to toggle source
# File lib/govuk_sidekiq/govuk_json_formatter.rb, line 6
def call(severity, time, _, message)
  hash = {
    "@timestamp": time.utc.iso8601(3),
    pid: ::Process.pid,
    tid:,
    level: severity,
    message:,
    tags: %w[sidekiq],
  }
  ctx.each { |key, value| hash[key] = value unless hash[key] }
  Sidekiq.dump_json(hash) << "\n"
end