1
0
Fork 0
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:
Yves Senn 2014-09-05 09:12:37 +02:00
commit ce43e8a6fc

View file

@ -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