lib/timber/integrations/rack/user_context.rb in timber-2.1.0.rc2 vs lib/timber/integrations/rack/user_context.rb in timber-2.1.0.rc3

- old
+ new

@@ -1,5 +1,7 @@ +require "timber/config" +require "timber/contexts/user" require "timber/integrations/rack/middleware" module Timber module Integrations module Rack @@ -77,24 +79,24 @@ def get_user_hash(env) # The order is relevant here. The 'warden' key can be set, but # not return a user, in which case the user data might be in the omniauth # data. if self.class.custom_user_hash.is_a?(Proc) - debug { "Obtaining user context from the custom user hash" } + Timber::Config.instance.debug { "Obtaining user context from the custom user hash" } self.class.custom_user_hash.call(env) elsif (auth_hash = env['omniauth.auth']) - debug { "Obtaining user context from the omniauth auth hash" } + Timber::Config.instance.debug { "Obtaining user context from the omniauth auth hash" } get_omniauth_user_hash(auth_hash) elsif env[:clearance] && env[:clearance].signed_in? - debug { "Obtaining user context from the clearance user" } + Timber::Config.instance.debug { "Obtaining user context from the clearance user" } user = env[:clearance].current_user get_user_object_hash(user) elsif env['warden'] && (user = env['warden'].user) - debug { "Obtaining user context from the warden user" } + Timber::Config.instance.debug { "Obtaining user context from the warden user" } get_user_object_hash(user) else - debug { "Could not locate any user data" } + Timber::Config.instance.debug { "Could not locate any user data" } nil end end def get_omniauth_user_hash(auth_hash) @@ -136,20 +138,9 @@ def try_user_email(user) if user.respond_to?(:email) && user.email.is_a?(String) user.email else nil - end - end - - def debug_logger - Timber::Config.instance.debug_logger - end - - def debug(&block) - if debug_logger - message = yield - debug_logger.debug(message) end end end end end \ No newline at end of file