Allow Worker work method to specify the log verbosity

main
Javier Lopez 9 years ago
parent 00645434ac
commit 43cb51064a

@ -14,7 +14,7 @@ except ImportError:
from rq.utils import ColorizingStreamHandler
def setup_loghandlers(level='INFO'):
def setup_loghandlers(level):
logger = logging.getLogger('rq.worker')
if not logger.handlers:
logger.setLevel(level)

@ -388,7 +388,7 @@ class Worker(object):
if before_state:
self.set_state(before_state)
def work(self, burst=False):
def work(self, burst=False, logging_level=logging.INFO):
"""Starts the work loop.
Pops and performs all jobs on the current list of queues. When all
@ -397,7 +397,7 @@ class Worker(object):
The return value indicates whether any jobs were processed.
"""
setup_loghandlers()
setup_loghandlers(logging_level)
self._install_signal_handlers()
did_perform_work = False

Loading…
Cancel
Save