Sha256: 2080bcf82c2c00eefbdb630d227d29466d7ebb99c93baafc3fe0f91b930a2030

Contents?: true

Size: 1017 Bytes

Versions: 3

Compression:

Stored size: 1017 Bytes

Contents

module Binnacle
  module Trap
    class Railtie < ::Rails::Railtie
      initializer "binnacle.middleware" do |app|
        Binnacle.binnacle_logger.info "Installing Rails Binnacle Middleware..."

        # Exception Trapping
        if ::Rails::VERSION::MAJOR >= 5
          app.config.middleware.insert_after ActionDispatch::DebugExceptions, Binnacle::Trap::Middleware
        else
          exception_class = defined?(ActionDispatch::DebugExceptions) ? "DebugExceptions" : "ShowExceptions"
          app.config.middleware.insert_after "ActionDispatch::#{exception_class}", "Binnacle::Trap::Middleware"
        end
      end

      # Logging
      config.before_configuration do |app|
        app.config.log_tags = [ :uuid, :remote_ip ]
      end

      config.after_initialize do |app|
        if Binnacle.configuration.intercept_rails_logging? && !Binnacle.configuration.rails_verbose_logging?
          Binnacle::Logging::RequestLogSubscriber.attach_to :action_controller
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
binnacle-0.5.0 lib/binnacle/trap/railtie.rb
binnacle-0.4.9 lib/binnacle/trap/railtie.rb
binnacle-0.4.8 lib/binnacle/trap/railtie.rb