diff --git a/lib/lograge.rb b/lib/lograge.rb index 06f27f74..5e2de205 100644 --- a/lib/lograge.rb +++ b/lib/lograge.rb @@ -62,8 +62,8 @@ def before_format(data, payload) def ignore_actions(actions) ignore(lambda do |event| - params = event.payload[:params] - Array(actions).include?("#{params['controller']}##{params['action']}") + params = event.payload + Array(actions).include?("#{params[:controller]}##{params[:action]}") end) end diff --git a/lib/lograge/log_subscriber.rb b/lib/lograge/log_subscriber.rb index 87487bfb..bf59a379 100644 --- a/lib/lograge/log_subscriber.rb +++ b/lib/lograge/log_subscriber.rb @@ -45,8 +45,8 @@ def initial_data(payload) method: payload[:method], path: extract_path(payload), format: extract_format(payload), - controller: payload[:params]['controller'], - action: payload[:params]['action'] + controller: payload[:controller], + action: payload[:action] } end diff --git a/spec/lograge_logsubscriber_spec.rb b/spec/lograge_logsubscriber_spec.rb index db416b83..4ba9dc70 100644 --- a/spec/lograge_logsubscriber_spec.rb +++ b/spec/lograge_logsubscriber_spec.rb @@ -12,7 +12,7 @@ end let(:subscriber) { Lograge::RequestLogSubscriber.new } - let(:event_params) { { 'controller' => 'home', 'action' => 'index', 'foo' => 'bar' } } + let(:event_params) { { 'foo' => 'bar' } } let(:event) do ActiveSupport::Notifications::Event.new( @@ -21,6 +21,8 @@ Time.now, 2, status: 200, + controller: 'home', + action: 'index', format: 'application/json', method: 'GET', path: '/home?foo=bar',