Sha256: b37d8bae883ba5c7b705082c96b99caeb051d7219833950125d76f445493cfa2

Contents?: true

Size: 592 Bytes

Versions: 4

Compression:

Stored size: 592 Bytes

Contents

require 'sidekiq/logging/shared'

module Sidekiq
  class LogstashJobLogger
    include Sidekiq::Logging::Shared

    def call(job, _queue)
      started_at = Time.now.utc
      yield
      Sidekiq.logger.info log_job(job, started_at)
    rescue => exc
      begin
        Sidekiq.logger.warn log_job(job, started_at, exc)
      rescue => ex
        Sidekiq.logger.error 'Error logging the job execution!'
        Sidekiq.logger.error "Job: #{job}"
        Sidekiq.logger.error "Job Exception: #{exc}"
        Sidekiq.logger.error "Log Exception: #{ex}"
      end
      raise
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sidekiq-logstash-1.1.0 lib/sidekiq/logstash_job_logger.rb
sidekiq-logstash-1.0.1 lib/sidekiq/logstash_job_logger.rb
sidekiq-logstash-1.0.0 lib/sidekiq/logstash_job_logger.rb
sidekiq-logstash-0.3.0 lib/sidekiq/logstash_job_logger.rb