Sha256: a1810bcbf4bd9710d14f5b8d32c277eb34007ae5d74ff06262a12323c701cd52

Contents?: true

Size: 688 Bytes

Versions: 17

Compression:

Stored size: 688 Bytes

Contents

require "action_controller/log_subscriber"

class ActionController::LogSubscriber # rubocop:disable ClassAndModuleChildren
  # Log as info to show Processing messages in production
  def start_processing(event)
    controller_logger(event).info { "Processing ##{event.payload[:action]}" }
  end

  private

  # Returns the logger for the supplied event.
  # Returns ActionController::Base.logger if no controller is present
  def controller_logger(event)
    if (controller = event.payload[:controller])
      begin
        controller.constantize.logger
      rescue NameError
        ActionController::Base.logger
      end
    else
      ActionController::Base.logger
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
sapience-0.2.4 lib/sapience/extensions/action_controller/log_subscriber_processing.rb
sapience-0.2.3 lib/sapience/extensions/action_controller/log_subscriber_processing.rb
sapience-0.2.2 lib/sapience/extensions/action_controller/log_subscriber_processing.rb
sapience-0.2.1 lib/sapience/extensions/action_controller/log_subscriber_processing.rb
sapience-0.2.0 lib/sapience/extensions/action_controller/log_subscriber_processing.rb
sapience-0.1.13 lib/sapience/extensions/action_controller/log_subscriber_processing.rb
sapience-0.1.12 lib/sapience/extensions/action_controller/log_subscriber_processing.rb
sapience-0.1.11 lib/sapience/extensions/action_controller/log_subscriber_processing.rb
sapience-0.1.10 lib/sapience/extensions/action_controller/log_subscriber_processing.rb
sapience-0.1.9 lib/sapience/extensions/action_controller/log_subscriber_processing.rb
sapience-0.1.8 lib/sapience/extensions/action_controller/log_subscriber_processing.rb
sapience-0.1.7 lib/sapience/extensions/action_controller/log_subscriber_processing.rb
sapience-0.1.6 lib/sapience/extensions/action_controller/log_subscriber_processing.rb
sapience-0.1.5 lib/sapience/extensions/action_controller/log_subscriber_processing.rb
sapience-0.1.4 lib/sapience/extensions/action_controller/log_subscriber_processing.rb
sapience-0.1.3 lib/sapience/extensions/action_controller/log_subscriber_processing.rb
sapience-0.1.2 lib/sapience/extensions/action_controller/log_subscriber_processing.rb