lib/timber/integrations/rack.rb in timber-2.0.24 vs lib/timber/integrations/rack.rb in timber-2.1.0.rc1

- old
+ new

@@ -5,13 +5,23 @@ require "timber/integrations/rack/user_context" module Timber module Integrations module Rack - # All available middlewares. The order is relevant. Middlewares that set + # 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] + @middlewares ||= [HTTPContext, SessionContext, UserContext, + HTTPEvents, ExceptionEvent].select(&:enabled?) end end end end \ No newline at end of file