diff options
author | Guo Xiang Tan <tgx_world@hotmail.com> | 2014-08-22 17:47:13 +0800 |
---|---|---|
committer | Guo Xiang Tan <tgx_world@hotmail.com> | 2014-08-22 17:47:13 +0800 |
commit | fb740239dc0ea7e543388f057e205c68b67a449c (patch) | |
tree | 654a258b08be43673308d5f76ea5470efdbb541a /activejob/lib/active_job | |
parent | 880a1d8ac96669da92d86873b4203b1f9194e21a (diff) | |
download | rails-fb740239dc0ea7e543388f057e205c68b67a449c.tar.gz rails-fb740239dc0ea7e543388f057e205c68b67a449c.tar.bz2 rails-fb740239dc0ea7e543388f057e205c68b67a449c.zip |
Pass logging message through block.
This follows the good practice listed on http://guides.rubyonrails.org/debugging_rails_applications.html#impact-of-logs-on-performance
Diffstat (limited to 'activejob/lib/active_job')
-rw-r--r-- | activejob/lib/active_job/logging.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/activejob/lib/active_job/logging.rb b/activejob/lib/active_job/logging.rb index d9e544acf5..ae098a80f3 100644 --- a/activejob/lib/active_job/logging.rb +++ b/activejob/lib/active_job/logging.rb @@ -52,19 +52,19 @@ module ActiveJob class LogSubscriber < ActiveSupport::LogSubscriber def enqueue(event) - info "Enqueued #{event.payload[:job].name} (Job ID: #{event.payload[:job_id]}) to #{queue_name(event)}" + args_info(event) + info { "Enqueued #{event.payload[:job].name} (Job ID: #{event.payload[:job_id]}) to #{queue_name(event)}" + args_info(event) } end def enqueue_at(event) - info "Enqueued #{event.payload[:job].name} (Job ID: #{event.payload[:job_id]}) to #{queue_name(event)} at #{enqueued_at(event)}" + args_info(event) + info { "Enqueued #{event.payload[:job].name} (Job ID: #{event.payload[:job_id]}) to #{queue_name(event)} at #{enqueued_at(event)}" + args_info(event) } end def perform_start(event) - info "Performing #{event.payload[:job].name} from #{queue_name(event)}" + args_info(event) + info { "Performing #{event.payload[:job].name} from #{queue_name(event)}" + args_info(event) } end def perform(event) - info "Performed #{event.payload[:job].name} from #{queue_name(event)} in #{event.duration.round(2).to_s}ms" + info { "Performed #{event.payload[:job].name} from #{queue_name(event)} in #{event.duration.round(2).to_s}ms" } end private |