Sha256: c03633ca138a42c10e4fe75892438b13d2456edd6ec4f596a119972eaff64c4e

Contents?: true

Size: 935 Bytes

Versions: 8

Compression:

Stored size: 935 Bytes

Contents

require "timber/integrations/rack/exception_event"
require "timber/integrations/rack/http_context"
require "timber/integrations/rack/http_events"
require "timber/integrations/rack/session_context"
require "timber/integrations/rack/user_context"

module Timber
  module Integrations
    module Rack
      # Enable / disable all Rack middlewares with a single setting.
      def self.enabled=(value)
        ExceptionEvent.enabled = value
        HTTPContext.enabled = value
        HTTPEvents.enabled = value
        SessionContext.enabled = value
        UserContext.enabled = value
      end

      # All enabled middlewares. The order is relevant. Middlewares that set
      # context are added first so that context is included in subsequent log lines.
      def self.middlewares
        @middlewares ||= [HTTPContext, SessionContext, UserContext,
          HTTPEvents, ExceptionEvent].select(&:enabled?)
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
timber-2.1.1 lib/timber/integrations/rack.rb
timber-2.1.0 lib/timber/integrations/rack.rb
timber-2.1.0.rc6 lib/timber/integrations/rack.rb
timber-2.1.0.rc5 lib/timber/integrations/rack.rb
timber-2.1.0.rc4 lib/timber/integrations/rack.rb
timber-2.1.0.rc3 lib/timber/integrations/rack.rb
timber-2.1.0.rc2 lib/timber/integrations/rack.rb
timber-2.1.0.rc1 lib/timber/integrations/rack.rb