Skip to content

Commit

Permalink
Make #32 compatible with Sidekiq 6.4 or earlier. (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
iMacTia authored Aug 12, 2022
1 parent 21a4560 commit ef1978d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/sidekiq/logstash.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@ def self.setup(_opts = {})
end

# Add logstash support
config[:job_logger] = Sidekiq::LogstashJobLogger
if config.respond_to?(:[]=)
# Only available from Sidekiq 6.5
config[:job_logger] = Sidekiq::LogstashJobLogger
else
# This is deprecated and will be removed in Sidekiq 7.0
config.options[:job_logger] = Sidekiq::LogstashJobLogger
end

# Set custom formatter for Sidekiq logger
config.logger.formatter = Sidekiq::Logging::LogstashFormatter.new
Expand Down

0 comments on commit ef1978d

Please sign in to comment.