1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00

rename method

This commit is contained in:
Mike Perham 2019-09-25 15:53:04 -07:00
parent c8fb57b2c0
commit fd634c05fd
3 changed files with 6 additions and 6 deletions

View file

@ -23,7 +23,7 @@ module Sidekiq
raise
end
def with_job_hash_context_and_log_level(job_hash, &block)
def prepare(job_hash, &block)
level = job_hash["log_level"]
if level
@logger.log_at(level) do

View file

@ -117,7 +117,7 @@ module Sidekiq
# job structure to the Web UI
pristine = cloned(job_hash)
@job_logger.with_job_hash_context_and_log_level(job_hash) do
@job_logger.prepare(job_hash) do
@retrier.global(pristine, queue) do
@job_logger.call(job_hash, queue) do
stats(pristine, queue) do

View file

@ -27,7 +27,7 @@ class TestJobLogger < Minitest::Test
p = @logger.formatter = Sidekiq::Logger::Formatters::Pretty.new
job = {"jid"=>"1234abc", "wrapped"=>"FooWorker", "class"=>"Wrapper", "tags" => ["bar", "baz"]}
# this mocks what Processor does
jl.with_job_hash_context_and_log_level(job) do
jl.prepare(job) do
jl.call(job, 'queue') {}
end
@ -47,7 +47,7 @@ class TestJobLogger < Minitest::Test
jl = Sidekiq::JobLogger.new(@logger)
job = {"jid"=>"1234abc", "wrapped"=>"Wrapper", "class"=>"FooWorker", "bid"=>"b-xyz", "tags" => ["bar", "baz"]}
# this mocks what Processor does
jl.with_job_hash_context_and_log_level(job) do
jl.prepare(job) do
jl.call(job, 'queue') {}
end
a, b = @output.string.lines
@ -65,7 +65,7 @@ class TestJobLogger < Minitest::Test
job = {"class"=>"FooWorker", "log_level"=>"debug"}
assert @logger.info?
jl.with_job_hash_context_and_log_level(job) do
jl.prepare(job) do
jl.call(job, "queue") do
assert @logger.debug?
@logger.debug("debug message")
@ -84,7 +84,7 @@ class TestJobLogger < Minitest::Test
job = {"class"=>"FooWorker", "log_level"=>"non_existent"}
assert @logger.info?
jl.with_job_hash_context_and_log_level(job) do
jl.prepare(job) do
jl.call(job, "queue") do
assert @logger.info?
end