lib/logjoy/log_subscribers/action_controller.rb in logjoy-0.2.0 vs lib/logjoy/log_subscribers/action_controller.rb in logjoy-0.3.0
- old
+ new
@@ -6,10 +6,12 @@
module Logjoy
module LogSubscribers
class ActionController < ActiveSupport::LogSubscriber
def process_action(event)
+ return if ignore_event?(event)
+
info do
payload = event.payload
log = payload.slice(:controller, :action, :format, :method, :path, :status)
log[:view_runtime] = rounded_ms(payload[:view_runtime])
@@ -32,9 +34,13 @@
def logger
::ActionController::Base.logger
end
private
+
+ def ignore_event?(event)
+ Logjoy.filters.include?(event.payload[:path])
+ end
def rounded_ms(value)
return 'N/A' if value.nil?
value.round(3)