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



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

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