Remove unwanted logging configuration

This commit is contained in:
Jakub Stasiak 2013-07-10 16:49:48 +01:00
parent 4672094212
commit b406ecc515
2 changed files with 11 additions and 6 deletions

View File

@ -584,7 +584,15 @@ Logging
Injector uses standard :mod:`logging` module, the logger name is ``injector``.
By default ``injector`` logger is configured to use :class:`logging.NullHandler`.
By default ``injector`` logger is not configured to print logs anywhere.
To enable ``get()`` tracing you need to set ``injector`` logger level to ``DEBUG``. You can do that programatically by executing:
```pycon
import logging
logging.getLogger('injector').setLevel(logging.DEBUG)
```
Thread safety
-------------

View File

@ -37,11 +37,8 @@ __author__ = 'Alec Thomas <alec@swapoff.org>'
__version__ = '0.7.4'
__version_tag__ = ''
# 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):
@ -561,9 +558,9 @@ class Injector(object):
raise Error('%s; scopes must be explicitly bound '
'with Binder.bind_scope(scope_cls)' % e)
log.info('%sInjector.get(%r, annotation=%r, scope=%r) using %r', self._log_prefix, interface, annotation, scope, binding.provider)
log.debug('%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.info('%s -> %r', self._log_prefix, result)
log.debug('%s -> %r', self._log_prefix, result)
return result
def create_child_injector(self, *args, **kwargs):