Sha256: 9cbf9b19305d6f6ed55561a448534a0bdcba252ca46690871bcaa3119e2c51d0

Contents?: true

Size: 761 Bytes

Versions: 1

Compression:

Stored size: 761 Bytes

Contents

require 'action_controller/log_subscriber'
ActionController::LogSubscriber

module ActionController
  class LogSubscriber
    # 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 || ActionController::Base.logger
        rescue NameError
          ActionController::Base.logger
        end
      else
        ActionController::Base.logger
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails_semantic_logger-4.2.1 lib/rails_semantic_logger/extensions/action_controller/log_subscriber_processing.rb