diff options
author | Guo Xiang Tan <tgx_world@hotmail.com> | 2014-07-18 14:27:08 +0800 |
---|---|---|
committer | Guo Xiang Tan <tgx_world@hotmail.com> | 2014-07-18 15:04:43 +0800 |
commit | ee35b79d4cff24b960be54c3f5c4f46627c069fe (patch) | |
tree | 51bf939c44a735fe9aad005f1f9c880a396bbc73 /actionview | |
parent | d4c8068675f0b6be025590471b40ff175daa845e (diff) | |
download | rails-ee35b79d4cff24b960be54c3f5c4f46627c069fe.tar.gz rails-ee35b79d4cff24b960be54c3f5c4f46627c069fe.tar.bz2 rails-ee35b79d4cff24b960be54c3f5c4f46627c069fe.zip |
Prefer to pass block when logging.
The Logger by default includes a guard which checks for the
logging level. By removing the custom logging guards, we can decouple
the logging guard from the logging action to be done.
This also follows the good practice listed on http://guides.rubyonrails.org/debugging_rails_applications.html#impact-of-logs-on-performance.
Diffstat (limited to 'actionview')
-rw-r--r-- | actionview/lib/action_view/log_subscriber.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/actionview/lib/action_view/log_subscriber.rb b/actionview/lib/action_view/log_subscriber.rb index 6c8d9cb5bf..9047dbdd85 100644 --- a/actionview/lib/action_view/log_subscriber.rb +++ b/actionview/lib/action_view/log_subscriber.rb @@ -13,11 +13,11 @@ module ActionView end def render_template(event) - return unless logger.info? - message = " Rendered #{from_rails_root(event.payload[:identifier])}" - message << " within #{from_rails_root(event.payload[:layout])}" if event.payload[:layout] - message << " (#{event.duration.round(1)}ms)" - info(message) + info do + message = " Rendered #{from_rails_root(event.payload[:identifier])}" + message << " within #{from_rails_root(event.payload[:layout])}" if event.payload[:layout] + message << " (#{event.duration.round(1)}ms)" + end end alias :render_partial :render_template alias :render_collection :render_template |