diff --git a/.ruby-gemset b/.ruby-gemset deleted file mode 100644 index c4fdec0..0000000 --- a/.ruby-gemset +++ /dev/null @@ -1 +0,0 @@ -sidekiq-logstash \ No newline at end of file diff --git a/.ruby-version b/.ruby-version deleted file mode 100644 index 860487c..0000000 --- a/.ruby-version +++ /dev/null @@ -1 +0,0 @@ -2.7.1 diff --git a/lib/sidekiq/logstash.rb b/lib/sidekiq/logstash.rb index be7c831..bf52ddb 100644 --- a/lib/sidekiq/logstash.rb +++ b/lib/sidekiq/logstash.rb @@ -22,8 +22,11 @@ def self.configure def self.setup(_opts = {}) # Calls Sidekiq.configure_server to inject logics Sidekiq.configure_server do |config| - # Remove default Sidekiq error_handler that logs errors - config.error_handlers.delete_if { |h| h.is_a?(Sidekiq::ExceptionHandler::Logger) } + if defined?(Sidekiq::ExceptionHandler::Logger) + # Remove default Sidekiq error_handler that logs errors + # 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 diff --git a/spec/sidekiq/logstash_spec.rb b/spec/sidekiq/logstash_spec.rb index 9e61d44..45491f8 100644 --- a/spec/sidekiq/logstash_spec.rb +++ b/spec/sidekiq/logstash_spec.rb @@ -13,8 +13,8 @@ def process(worker, params = [], encrypt: false) let(:buffer) { StringIO.new } let(:logger) { Logger.new(buffer) } let(:job) { build(:job) } - let(:processor_options) { { queues: ['default'] } } - let(:processor) { ::Sidekiq::Processor.new(nil, processor_options) } + let(:processor_options) { Sidekiq } + let(:processor) { ::Sidekiq::Processor.new(processor_options) } let(:log_message) { JSON.parse(buffer.string) } let(:log_messages) { buffer.string.split("\n").map { |log| JSON.parse(log) } }