Class: RailsCom::ActionController::Subscriber

Inherits:
ActiveSupport::LogSubscriber
  • Object
show all
Defined in:
lib/rails_com/action_controller/subscriber.rb

Instance Method Summary collapse

Instance Method Details

#process_action(event) ⇒ Object



19
20
21
22
23
24
25
26
27
28
# File 'lib/rails_com/action_controller/subscriber.rb', line 19

def process_action(event)
  payload = event.payload

  return if payload[:exception_object].blank?
  return if RailsCom.config.ignore_exception.include?(payload[:exception_object].class.to_s)
  return if Rails.env.development? && RailsCom.config.disable_debug

  err = Com::Err.new
  err.record!(payload)
end

#start_processing(event) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/rails_com/action_controller/subscriber.rb', line 4

def start_processing(event)
  return unless logger.debug?
  payload = event.payload
  raw_headers = payload.fetch(:headers, {})
  real_headers = Com::Err.request_headers(raw_headers)
  session_key = Rails.configuration.session_options[:key]
  cookies = Hash(raw_headers['rack.request.cookie_hash']).except(session_key)

  debug "  Headers: #{real_headers.inspect}"
  debug "  Sessions: #{raw_headers['rack.session'].to_h}" unless raw_headers['rack.session'].blank?
  debug "  Cookies: #{cookies}" unless cookies.blank?
  debug "  Ancestors: #{event.payload[:request].controller_class.ancestors.yield_self { |i| i.slice(0..(i.index(ActionController::Base) || i.index(ActionController::API))) }}"
  debug "  Prefixes:  #{event.payload[:request].controller_class._prefixes}"
end