Module: DispatcherExtensions

Defined in:
lib/action_dispatch/routing/route_set/dispatcher.rb

Overview

Monkey patch the rails dispatcher just before it hands over control to our controller implementation. In doing so, we can included the name of the controller and action to be executed in all calls to Rails.logger in the context of any of our application controllers. Note the use of `prepend` to deal with the fact that the `dispatch()` function is class private.

Instance Method Summary collapse

Instance Method Details

#dispatch(controller, action, env) ⇒ Object


10
11
12
13
14
# File 'lib/action_dispatch/routing/route_set/dispatcher.rb', line 10

def dispatch(controller, action, env)
  Rails.logger.tagged({ controller: controller.to_s, action: action.to_s }) do
    super
  end
end