Pass block for logging.

This follows the good practice listed on http://guides.rubyonrails.org/debugging_rails_applications.html#impact-of-logs-on-performance.
This commit is contained in:
Guo Xiang Tan 2014-08-09 13:47:24 +08:00
parent 30529dc00f
commit bc53543cb3
1 changed files with 6 additions and 4 deletions

View File

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