Add a NullHandler when setting up library logging

I was gunna write a test, but mocking ImportErrors is a PITA, so I decided to
just get my tox py26 working instead.  Tests seem to fail/pass as expected
without/with the inline NullHanlder.

Closes-Bug: 1212861

Change-Id: I20207374a77ee9969ab201c3a57e4caf40c02a61
This commit is contained in:
Clay Gerrard 2013-08-15 18:46:33 -07:00
parent c626c2a87e
commit ec14619ef0

View File

@ -35,7 +35,22 @@ try:
except ImportError:
HTTPSConnectionNoSSLComp = HTTPSConnection
try:
from logging import NullHandler
except ImportError:
class NullHandler(logging.Handler):
def handle(self, record):
pass
def emit(self, record):
pass
def createLock(self):
self.lock = None
logger = logging.getLogger("swiftclient")
logger.addHandler(NullHandler())
def http_log(args, kwargs, resp, body):