Sha256: 1664d54a35c2a6aa4f41066342dcd95cb071bfd4a3518d610211cf6daa51adcb

Contents?: true

Size: 923 Bytes

Versions: 26

Compression:

Stored size: 923 Bytes

Contents

require "timber/integrations/rack/error_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)
        ErrorEvent.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, ErrorEvent].select(&:enabled?)
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
timber-2.6.2 lib/timber/integrations/rack.rb
timber-2.6.1 lib/timber/integrations/rack.rb
timber-2.6.0 lib/timber/integrations/rack.rb
timber-2.6.0.pre.beta2 lib/timber/integrations/rack.rb
timber-2.6.0.pre.beta1 lib/timber/integrations/rack.rb
timber-2.5.1 lib/timber/integrations/rack.rb
timber-2.5.0 lib/timber/integrations/rack.rb
timber-2.4.0 lib/timber/integrations/rack.rb
timber-2.3.4 lib/timber/integrations/rack.rb
timber-2.3.3 lib/timber/integrations/rack.rb
timber-2.3.2 lib/timber/integrations/rack.rb
timber-2.3.1 lib/timber/integrations/rack.rb
timber-2.3.0 lib/timber/integrations/rack.rb
timber-2.2.3 lib/timber/integrations/rack.rb
timber-2.2.2 lib/timber/integrations/rack.rb
timber-2.2.1 lib/timber/integrations/rack.rb
timber-2.2.0 lib/timber/integrations/rack.rb
timber-2.1.10 lib/timber/integrations/rack.rb
timber-2.1.9 lib/timber/integrations/rack.rb
timber-2.1.8 lib/timber/integrations/rack.rb