Sha256: c8fdc22e6055fccf576457f8aea6e301b9eb9cebc8e343d8661b2cab723cb5d8

Contents?: true

Size: 713 Bytes

Versions: 4

Compression:

Stored size: 713 Bytes

Contents

require 'sidekiq/logging/shared'

module Sidekiq
  module Middleware
    module Server
      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
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sidekiq-logstash-1.1.0 lib/sidekiq/middleware/server/logstash_logging.rb
sidekiq-logstash-1.0.1 lib/sidekiq/middleware/server/logstash_logging.rb
sidekiq-logstash-1.0.0 lib/sidekiq/middleware/server/logstash_logging.rb
sidekiq-logstash-0.3.0 lib/sidekiq/middleware/server/logstah_logging.rb