Merge pull request #687 from jlopex/javi/allow_quiet_worker_class

Allow Worker work method to specify the log verbosity
main
Selwin Ong 9 years ago
commit cd0414361c

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

@ -407,7 +407,7 @@ class Worker(object):
if before_state: if before_state:
self.set_state(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. """Starts the work loop.
Pops and performs all jobs on the current list of queues. When all Pops and performs all jobs on the current list of queues. When all
@ -416,7 +416,7 @@ class Worker(object):
The return value indicates whether any jobs were processed. The return value indicates whether any jobs were processed.
""" """
setup_loghandlers() setup_loghandlers(logging_level)
self._install_signal_handlers() self._install_signal_handlers()
did_perform_work = False did_perform_work = False

Loading…
Cancel
Save