diff --git a/kazoo/client.py b/kazoo/client.py index 27b7c384..d000688e 100644 --- a/kazoo/client.py +++ b/kazoo/client.py @@ -221,7 +221,9 @@ def __init__( self.logger = logger or log # Record the handler strategy used - self.handler = handler if handler else SequentialThreadingHandler() + self.handler = handler + if not handler: + self.handler = SequentialThreadingHandler(logger=self.logger) if inspect.isclass(self.handler): raise ConfigurationError( "Handler must be an instance of a class, " diff --git a/kazoo/handlers/threading.py b/kazoo/handlers/threading.py index b9acd875..83eebc51 100644 --- a/kazoo/handlers/threading.py +++ b/kazoo/handlers/threading.py @@ -96,8 +96,9 @@ class SequentialThreadingHandler(object): queue_impl = queue.Queue queue_empty = queue.Empty - def __init__(self): + def __init__(self, logger=None): """Create a :class:`SequentialThreadingHandler` instance""" + self.logger = logger or log self.callback_queue = self.queue_impl() self.completion_queue = self.queue_impl() self._running = False @@ -109,6 +110,8 @@ def running(self): return self._running def _create_thread_worker(self, work_queue): + log = self.logger + def _thread_worker(): # pragma: nocover while True: try: