aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuo Xiang Tan <tgx_world@hotmail.com>2014-08-09 13:47:24 +0800
committerGuo Xiang Tan <tgx_world@hotmail.com>2014-08-09 13:47:24 +0800
commitbc53543cb3805abd334745a50c9014b31096c8da (patch)
tree7d40324ad5aa88b0ee7158ab387db23b21f244f8
parent30529dc00f96777c325dff496930f560fb9d59e9 (diff)
downloadrails-bc53543cb3805abd334745a50c9014b31096c8da.tar.gz
rails-bc53543cb3805abd334745a50c9014b31096c8da.tar.bz2
rails-bc53543cb3805abd334745a50c9014b31096c8da.zip
Pass block for logging.
This follows the good practice listed on http://guides.rubyonrails.org/debugging_rails_applications.html#impact-of-logs-on-performance.
-rw-r--r--actionpack/lib/action_controller/metal/live.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/actionpack/lib/action_controller/metal/live.rb b/actionpack/lib/action_controller/metal/live.rb
index 706ce04062..c9ef3a3dad 100644
--- a/actionpack/lib/action_controller/metal/live.rb
+++ b/actionpack/lib/action_controller/metal/live.rb
@@ -303,10 +303,12 @@ module ActionController
logger = ActionController::Base.logger
return unless logger
- message = "\n#{exception.class} (#{exception.message}):\n"
- message << exception.annoted_source_code.to_s if exception.respond_to?(:annoted_source_code)
- message << " " << exception.backtrace.join("\n ")
- logger.fatal("#{message}\n\n")
+ logger.fatal do
+ message = "\n#{exception.class} (#{exception.message}):\n"
+ message << exception.annoted_source_code.to_s if exception.respond_to?(:annoted_source_code)
+ message << " " << exception.backtrace.join("\n ")
+ "#{message}\n\n"
+ end
end
def response_body=(body)