Class: ActionDispatch::LogSubscriber

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

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#redirect(event) ⇒ Object



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

def redirect(event)
  payload = event.payload

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

  if ActionDispatch.verbose_redirect_logs
    info { "↳ #{payload[:source_location]}" }
  end

  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