mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #16807 from tgxworld/carry_out_assignment_within_block
Move variable assignment within logging block.
This commit is contained in:
commit
ce43e8a6fc
1 changed files with 16 additions and 8 deletions
|
@ -52,23 +52,31 @@ module ActiveJob
|
|||
|
||||
class LogSubscriber < ActiveSupport::LogSubscriber
|
||||
def enqueue(event)
|
||||
info do
|
||||
job = event.payload[:job]
|
||||
info { "Enqueued #{job.class.name} (Job ID: #{job.job_id}) to #{queue_name(event)}" + args_info(job) }
|
||||
"Enqueued #{job.class.name} (Job ID: #{job.job_id}) to #{queue_name(event)}" + args_info(job)
|
||||
end
|
||||
end
|
||||
|
||||
def enqueue_at(event)
|
||||
info do
|
||||
job = event.payload[:job]
|
||||
info { "Enqueued #{job.class.name} (Job ID: #{job.job_id}) to #{queue_name(event)} at #{scheduled_at(event)}" + args_info(job) }
|
||||
"Enqueued #{job.class.name} (Job ID: #{job.job_id}) to #{queue_name(event)} at #{scheduled_at(event)}" + args_info(job)
|
||||
end
|
||||
end
|
||||
|
||||
def perform_start(event)
|
||||
info do
|
||||
job = event.payload[:job]
|
||||
info { "Performing #{job.class.name} from #{queue_name(event)}" + args_info(job) }
|
||||
"Performing #{job.class.name} from #{queue_name(event)}" + args_info(job)
|
||||
end
|
||||
end
|
||||
|
||||
def perform(event)
|
||||
info do
|
||||
job = event.payload[:job]
|
||||
info { "Performed #{job.class.name} from #{queue_name(event)} in #{event.duration.round(2).to_s}ms" }
|
||||
"Performed #{job.class.name} from #{queue_name(event)} in #{event.duration.round(2).to_s}ms"
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
|
Loading…
Reference in a new issue