Class: Timber::Probes::ActionControllerLogSubscriber::LogSubscriber
- Inherits:
-
ActionController::LogSubscriber
- Object
- ActionController::LogSubscriber
- Timber::Probes::ActionControllerLogSubscriber::LogSubscriber
- Defined in:
- lib/timber/probes/action_controller_log_subscriber/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
#process_action(event) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/timber/probes/action_controller_log_subscriber/log_subscriber.rb', line 25 def process_action(event) info do payload = event.payload additions = ActionController::Base.log_process_action(payload) status = payload[:status] if status.nil? && payload[:exception].present? exception_class_name = payload[:exception].first status = extract_status(exception_class_name) end Events::HTTPResponse.new( status: status, time_ms: event.duration, additions: additions ) end end |
#start_processing(event) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/timber/probes/action_controller_log_subscriber/log_subscriber.rb', line 9 def start_processing(event) 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 |