提交 d446c798 编写于 作者: J James Cox 提交者: Aaron Patterson

make the logs a little simpler to view, put the render message inline with...

make the logs a little simpler to view, put the render message inline with other events, pull processing to char[0] and add a new line to the completed. looks more like a block now, which is useful for serial actions like test/dev
上级 d6413f04
......@@ -10,7 +10,7 @@ def start_processing(event)
format = payload[:format]
format = format.to_s.upcase if format.is_a?(Symbol)
info " Processing by #{payload[:controller]}##{payload[:action]} as #{format}"
info "Processing by #{payload[:controller]}##{payload[:action]} as #{format}"
info " Parameters: #{params.inspect}" unless params.empty?
end
......@@ -20,10 +20,11 @@ def process_action(event)
status = payload[:status]
if status.nil? && payload[:exception].present?
status = Rack::Utils.status_code(ActionDispatch::ShowExceptions.rescue_responses[payload[:exception].first]) rescue nil
end
status = Rack::Utils.status_code(ActionDispatch::ShowExceptions.rescue_responses[payload[:exception].first]) rescue nil
end
message = "Completed #{status} #{Rack::Utils::HTTP_STATUS_CODES[status]} in %.0fms" % event.duration
message << " (#{additions.join(" | ")})" unless additions.blank?
message << "\n"
info(message)
end
......@@ -59,4 +60,4 @@ def logger
end
end
ActionController::LogSubscriber.attach_to :action_controller
\ No newline at end of file
ActionController::LogSubscriber.attach_to :action_controller
......@@ -4,7 +4,7 @@ module ActionView
# Provides functionality so that Rails can output logs from Action View.
class LogSubscriber < ActiveSupport::LogSubscriber
def render_template(event)
message = "Rendered #{from_rails_root(event.payload[:identifier])}"
message = " Rendered #{from_rails_root(event.payload[:identifier])}"
message << " within #{from_rails_root(event.payload[:layout])}" if event.payload[:layout]
message << (" (%.1fms)" % event.duration)
info(message)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册