From ce2518ea82f038b27812fdac64f602c0870a86ea Mon Sep 17 00:00:00 2001 From: Raphael Sofaer Date: Sun, 26 Jun 2011 20:42:30 -0700 Subject: [PATCH] Docs for log_overrider --- lib/log_overrider.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/log_overrider.rb b/lib/log_overrider.rb index 506506616..0c0e5991e 100644 --- a/lib/log_overrider.rb +++ b/lib/log_overrider.rb @@ -1,4 +1,7 @@ class ActionView::LogSubscriber + + # In order to be more friendly to Splunk, which we use for log analysis, + # we override a few logging methods. There are not overriden if enable_splunk_logging is set to false in config/application.yml def render_template(event) count = event.payload[:count] || 1 hash = {:event => :render, @@ -18,6 +21,8 @@ end module ActionDispatch class ShowExceptions private + # This override logs in a format Splunk can more easily understand. + # @see ActionView::LogSubscriber#render_template def log_error(exception) return unless logger @@ -40,6 +45,8 @@ class ActionController::LogSubscriber #noop end + # This override logs in a format Splunk can more easily understand. + # @see ActionView::LogSubscriber#render_template def process_action(event) payload = event.payload additions = ActionController::Base.log_process_action(payload) @@ -68,6 +75,8 @@ end module Rails module Rack class Logger + # This override logs in a format Splunk can more easily understand. + # @see ActionView::LogSubscriber#render_template def before_dispatch(env) request = ActionDispatch::Request.new(env) path = request.fullpath @@ -80,6 +89,8 @@ end module ActiveRecord class LogSubscriber + # This override logs in a format Splunk can more easily understand. + # @see ActionView::LogSubscriber#render_template def sql(event) self.class.runtime += event.duration return unless logger.info?