From 43cb51064a560bdc7deff853eb94e78cd0820e33 Mon Sep 17 00:00:00 2001 From: Javier Lopez Date: Mon, 4 Apr 2016 16:22:26 +0200 Subject: [PATCH] Allow Worker work method to specify the log verbosity --- rq/logutils.py | 2 +- rq/worker.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rq/logutils.py b/rq/logutils.py index 2a23ae2..7f17c44 100644 --- a/rq/logutils.py +++ b/rq/logutils.py @@ -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) diff --git a/rq/worker.py b/rq/worker.py index 529f98d..87e7f17 100644 --- a/rq/worker.py +++ b/rq/worker.py @@ -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