Docs for log_overrider
This commit is contained in:
parent
d002c14aab
commit
ce2518ea82
1 changed files with 11 additions and 0 deletions
|
|
@ -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?
|
||||
|
|
|
|||
Loading…
Reference in a new issue