Class: ActionDispatch::LogSubscriber

Inherits:
ActiveSupport::EventReporter::LogSubscriber show all
Defined in:
actionpack/lib/action_dispatch/log_subscriber.rb

Overview

:nodoc:

Constant Summary

Constants inherited from ActiveSupport::EventReporter::LogSubscriber

ActiveSupport::EventReporter::LogSubscriber::LEVEL_CHECKS

Constants included from ActiveSupport::ColorizeLogging

ActiveSupport::ColorizeLogging::BLACK, ActiveSupport::ColorizeLogging::BLUE, ActiveSupport::ColorizeLogging::CYAN, ActiveSupport::ColorizeLogging::GREEN, ActiveSupport::ColorizeLogging::MAGENTA, ActiveSupport::ColorizeLogging::MODES, ActiveSupport::ColorizeLogging::RED, ActiveSupport::ColorizeLogging::WHITE, ActiveSupport::ColorizeLogging::YELLOW

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ActiveSupport::EventReporter::LogSubscriber

#emit, event_log_level, #logger, subscription_filter

Methods included from ActiveSupport::ColorizeLogging

#color, #colorize_logging, #debug, #error, #fatal, #info, #mode_from, #unknown, #warn

Methods included from ActiveSupport::Concern

#append_features, #class_methods, extended, #included, #prepend_features, #prepended

Class Method Details

.default_loggerObject



30
31
32
# File 'actionpack/lib/action_dispatch/log_subscriber.rb', line 30

def self.default_logger
  ActionController::Base.logger
end

Instance Method Details

#redirect(event) ⇒ Object



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

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]
    status_name = payload[:status_name]

    message = +"Completed #{status} #{status_name} in #{payload[:duration_ms].round}ms"
    message << "\n\n" if defined?(Rails.env) && Rails.env.development?

    message
  end
end