Module: RailsSemanticLogging::JobLogging::SidekiqPatch

Defined in:
lib/rails_semantic_logging/job_logging/sidekiq_patch.rb

Overview

Sidekiq patch to provide job context in every processed job log line. SemanticLogger uses its own thread for formatting, so Sidekiq::Context (stored in Thread.current) is lost. This patch wraps each job with SemanticLogger named tags for consistent structured output.

Instance Method Summary collapse

Instance Method Details

#call(item, queue) ⇒ Object

Parameters:

  • item (Hash)

    Sidekiq job hash

  • queue (String)

    Queue name



10
11
12
13
14
# File 'lib/rails_semantic_logging/job_logging/sidekiq_patch.rb', line 10

def call(item, queue)
  Sidekiq.logger.tagged(job_class: item['class'], job_id: item['jid'], queue: queue) do
    super(item, queue)
  end
end