Merge pull request #26 from dhellmann/bug/logging-py26
Update null log handling for py26
This commit is contained in:
commit
ea9266836e
|
@ -1,5 +1,13 @@
|
|||
# flake8: noqa
|
||||
|
||||
__all__ = [
|
||||
'ExtensionManager',
|
||||
'EnabledExtensionManager',
|
||||
'NamedExtensionManager',
|
||||
'HookManager',
|
||||
'DriverManager',
|
||||
]
|
||||
|
||||
from .extension import ExtensionManager
|
||||
from .enabled import EnabledExtensionManager
|
||||
from .named import NamedExtensionManager
|
||||
|
@ -10,9 +18,19 @@ import logging
|
|||
|
||||
# Configure a NullHandler for our log messages in case
|
||||
# the app we're used from does not set up logging.
|
||||
LOG = logging.getLogger(__name__)
|
||||
try:
|
||||
LOG = logging.getLogger('stevedore')
|
||||
|
||||
if hasattr(logging, 'NullHandler'):
|
||||
LOG.addHandler(logging.NullHandler())
|
||||
except AttributeError:
|
||||
# No NullHandler, probably python 2.6
|
||||
pass
|
||||
else:
|
||||
class NullHandler(logging.Handler):
|
||||
def handle(self, record):
|
||||
pass
|
||||
|
||||
def emit(self, record):
|
||||
pass
|
||||
|
||||
def createLock(self):
|
||||
self.lock = None
|
||||
|
||||
LOG.addHandler(NullHandler())
|
||||
|
|
Loading…
Reference in New Issue