Class: ActionDispatch::LogSubscriber

Inherits:
ActiveSupport::LogSubscriber
  • Object
show all
Defined in:
lib/action_dispatch/log_subscriber.rb

Instance Method Summary collapse

Instance Method Details

#redirect(event) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/action_dispatch/log_subscriber.rb', line 7

def redirect(event)
  payload = event.payload

  info { "Redirected to #{payload[:location]}" }

  info do
    status = payload[:status]

    message = +"Completed #{status} #{Rack::Utils::HTTP_STATUS_CODES[status]} in #{event.duration.round}ms"
    message << "\n\n" if defined?(Rails.env) && Rails.env.development?

    message
  end
end