Sha256: 55ce6fb313cabfbd26da580a688b6002aaefe213809087c4c39d0261b22ecba2

Contents?: true

Size: 1.51 KB

Versions: 17

Compression:

Stored size: 1.51 KB

Contents

module Logtail
  module Integrations
    module ActionDispatch
      # Responsible for disabled logging in the ActionDispatch::DebugExceptions
      # Rack middleware. We cannot simply remove the middleware because it is
      # coupled with displaying an exception debug screen if debug exceptions is enabled.
      #
      # @private
      class DebugExceptions < Integrator

        # Patch for disabling logging
        #
        # @private
        module InstanceMethods
          def self.included(klass)
            klass.class_eval do
              private
              def logger(*args)
                nil
              end
            end
          end
        end

        def initialize
          begin
            # Rails >= 3.1
            require "action_dispatch/middleware/debug_exceptions"
          rescue LoadError
            # Rails < 3.1
            require "action_dispatch/middleware/show_exceptions"
          end
        rescue LoadError => e
          raise RequirementNotMetError.new(e.message)
        end

        def integrate!
          if defined?(::ActionDispatch::DebugExceptions) && !::ActionDispatch::DebugExceptions.include?(InstanceMethods)
            ::ActionDispatch::DebugExceptions.send(:include, InstanceMethods)
          end

          if defined?(::ActionDispatch::ShowExceptions) && !::ActionDispatch::ShowExceptions.include?(InstanceMethods)
            ::ActionDispatch::ShowExceptions.send(:include, InstanceMethods)
          end

          true
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
logtail-rails-0.2.8 lib/logtail-rails/action_dispatch/debug_exceptions.rb
logtail-rails-0.2.7 lib/logtail-rails/action_dispatch/debug_exceptions.rb
logtail-rails-0.2.6 lib/logtail-rails/action_dispatch/debug_exceptions.rb
logtail-rails-0.2.5 lib/logtail-rails/action_dispatch/debug_exceptions.rb
logtail-rails-0.2.4 lib/logtail-rails/action_dispatch/debug_exceptions.rb
logtail-rails-0.2.3 lib/logtail-rails/action_dispatch/debug_exceptions.rb
logtail-rails-0.2.2 lib/logtail-rails/action_dispatch/debug_exceptions.rb
logtail-rails-0.2.1 lib/logtail-rails/action_dispatch/debug_exceptions.rb
logtail-rails-0.1.8 lib/logtail-rails/action_dispatch/debug_exceptions.rb
logtail-rails-0.1.7 lib/logtail-rails/action_dispatch/debug_exceptions.rb
logtail-rails-0.1.6 lib/logtail-rails/action_dispatch/debug_exceptions.rb
logtail-rails-0.1.5 lib/logtail-rails/action_dispatch/debug_exceptions.rb
logtail-rails-0.1.4 lib/logtail-rails/action_dispatch/debug_exceptions.rb
logtail-rails-0.1.3 lib/logtail-rails/action_dispatch/debug_exceptions.rb
logtail-rails-0.1.2 lib/logtail-rails/action_dispatch/debug_exceptions.rb
logtail-rails-0.1.1 lib/logtail-rails/action_dispatch/debug_exceptions.rb
logtail-rails-0.1.0 lib/logtail-rails/action_dispatch/debug_exceptions.rb