Class: Timber::Integrations::ActionController::LogSubscriber::TimberLogSubscriber

Inherits:
ActionController::LogSubscriber
  • Object
show all
Defined in:
lib/timber-rails/action_controller/log_subscriber/timber_log_subscriber.rb

Overview

The log subscriber that replaces the default ‘ActionController::LogSubscriber`. The intent of this subscriber is to, as transparently as possible, properly track events that are being logged here. This LogSubscriber will never change default behavior / log messages.

Instance Method Summary collapse

Instance Method Details

#start_processing(event) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/timber-rails/action_controller/log_subscriber/timber_log_subscriber.rb', line 12

def start_processing(event)
  return true if silence?

  info do
    payload = event.payload
    params  = payload[:params].except(*INTERNAL_PARAMS)
    format  = extract_format(payload)
    format  = format.to_s.upcase if format.is_a?(Symbol)

    Events::ControllerCall.new(
      controller: payload[:controller],
      action: payload[:action],
      format: format,
      params: params
    )
  end
end