lib/sidekiq/middleware/server/logstash_logging.rb in sidekiq-logstash-1.1.0 vs lib/sidekiq/middleware/server/logstash_logging.rb in sidekiq-logstash-1.2.0

- old
+ new

@@ -1,26 +1,17 @@ +# frozen_string_literal: true + require 'sidekiq/logging/shared' module Sidekiq module Middleware module Server + # Class used to replace Sidekiq 4 job logger. class LogstashLogging include Sidekiq::Logging::Shared - def call(_, job, _) - 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 + def call(_, job, _, &block) + log_job(job, &block) end end end end end