Skip to content

Commit

Permalink
Silence Ruby 2.7 warnings (#4412)
Browse files Browse the repository at this point in the history
Since you can pass kwargs to Logger.new, you need to explicitly handle them in the subclass otherwise you get a warning.
  • Loading branch information
Kevin Deisz authored and mperham committed Dec 31, 2019
1 parent c02cf76 commit cc1a37d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/sidekiq/logger.rb
Expand Up @@ -104,7 +104,7 @@ def add(severity, message = nil, progname = nil, &block)
class Logger < ::Logger
include LoggingUtils

def initialize(*args)
def initialize(*args, **kwargs)

This comment has been minimized.

Copy link
@pirj

pirj Feb 4, 2020

Contributor

Might be just def initialize(*)

super
self.formatter = Sidekiq.log_formatter
end
Expand Down
8 changes: 8 additions & 0 deletions test/test_logger.rb
Expand Up @@ -108,6 +108,14 @@ def test_json_output_is_parsable
assert_equal "INFO", hash["lvl"]
end

def test_forwards_logger_kwargs
assert_silent do
logger = Sidekiq::Logger.new('/dev/null', level: Logger::INFO)

assert_equal Logger::INFO, logger.level
end
end

def reset(io)
io.truncate(0)
io.rewind
Expand Down

0 comments on commit cc1a37d

Please sign in to comment.