class Logtail::Integrations::ActionController::LogSubscriber::LogtailLogSubscriber

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.

@private

Public Instance Methods

start_processing(event) click to toggle source
# File lib/logtail-rails/action_controller/log_subscriber/logtail_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

Private Instance Methods

extract_format(payload) click to toggle source
# File lib/logtail-rails/action_controller/log_subscriber/logtail_log_subscriber.rb, line 31
def extract_format(payload)
  if payload.key?(:format)
    payload[:format] # rails > 4.X
  elsif payload.key?(:formats)
    payload[:formats].first # rails 3.X
  end
end
silence?() click to toggle source
# File lib/logtail-rails/action_controller/log_subscriber/logtail_log_subscriber.rb, line 39
def silence?
  ActionController.silence?
end