lib/sidekiq/logstash.rb in sidekiq-logstash-2.0.2 vs lib/sidekiq/logstash.rb in sidekiq-logstash-2.0.3
- old
+ new
@@ -27,10 +27,16 @@
# NOTE: this only exists up until Sidekiq 6.4.x
config.error_handlers.delete_if { |h| h.is_a?(Sidekiq::ExceptionHandler::Logger) }
end
# Add logstash support
- config.options[: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
end
end