From e3245aabe1e239be87a5fc82b63f2f3bc111e125 Mon Sep 17 00:00:00 2001 From: Alec Thomas Date: Mon, 1 Jul 2013 18:47:59 -0400 Subject: [PATCH] Don't log by default, and split logging into info/debug. --- injector.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/injector.py b/injector.py index 978441e..89745fc 100644 --- a/injector.py +++ b/injector.py @@ -37,9 +37,11 @@ __author__ = 'Alec Thomas ' __version__ = '0.7.2' __version_tag__ = '' -log = logging.getLogger(__name__) -# log.setLevel(logging.WARNING) +# To enable get() tracing, getLogger('injector').setLevel(logging.INFO) +# To enable debug logging, setLevel(logging.DEBUG). +log = logging.getLogger('injector') log.addHandler(NullHandler()) +log.setLevel(logging.WARNING) def synchronized(lock): @@ -559,9 +561,9 @@ class Injector(object): raise Error('%s; scopes must be explicitly bound ' 'with Binder.bind_scope(scope_cls)' % e) - log.debug('%sGetting %r using %r', self._log_prefix, key, binding) + log.info('%sInjector.get(%r, annotation=%r, scope=%r) using %r', self._log_prefix, interface, annotation, scope, binding.provider) result = scope_instance.get(key, binding.provider).get() - log.debug('%sGot %r', self._log_prefix, result) + log.info('%s -> %r', self._log_prefix, result) return result def create_child_injector(self, *args, **kwargs):