PROTON-1347: For Python 2.6, define NullHandler if the logging module doesn't have it
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/4657d9fb Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/4657d9fb Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/4657d9fb Branch: refs/heads/go1 Commit: 4657d9fbd4ac999ce3aa6c790d2a80eb9334709d Parents: 7a381d2 Author: Justin Ross <[email protected]> Authored: Thu Aug 17 16:09:40 2017 -0700 Committer: Justin Ross <[email protected]> Committed: Thu Aug 17 16:09:40 2017 -0700 ---------------------------------------------------------------------- proton-c/bindings/python/proton/__init__.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/4657d9fb/proton-c/bindings/python/proton/__init__.py ---------------------------------------------------------------------- diff --git a/proton-c/bindings/python/proton/__init__.py b/proton-c/bindings/python/proton/__init__.py index 43f4067..f73e99d 100644 --- a/proton-c/bindings/python/proton/__init__.py +++ b/proton-c/bindings/python/proton/__init__.py @@ -37,8 +37,23 @@ from proton import _compat import logging, weakref, socket, sys, threading +try: + handler = logging.NullHandler() +except AttributeError: + class NullHandler(logging.Handler): + def handle(self, record): + pass + + def emit(self, record): + pass + + def createLock(self): + self.lock = None + + handler = NullHandler() + log = logging.getLogger("proton") -log.addHandler(logging.NullHandler()) +log.addHandler(handler) try: import uuid --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
