lib/timber/frameworks/rails.rb in timber-2.0.11 vs lib/timber/frameworks/rails.rb in timber-2.0.12

- old
+ new

@@ -11,11 +11,17 @@ # during the initialization process. initializer(:timber, group: :all, after: :initialize_logger) do logger = Rails.ensure_timber_logger(::Rails.logger) Rails.set_logger(logger) - Rails.configure_middlewares(config.app_middleware) Integrations.integrate! + end + + # Ensures that we insert the middlewares last. We need to insert these last + # because initializers, such as Omniauth, insert middleware. If we are not + # after these initializers we will not capture user context, for example. + initializer(:timber_middlewares, before: :build_middleware_stack) do + Rails.configure_middlewares(config.app_middleware) end end # This builds a new Timber::Logger from an existing logger. This allows us to transparentl # switch users onto the Timber::Logger since we support a more useful logging API. \ No newline at end of file