From 66235f7ad04dd9334749a22a971e5f06d1f280ac Mon Sep 17 00:00:00 2001 From: Donald Stufft Date: Tue, 21 Aug 2012 11:48:17 -0400 Subject: [PATCH] Switch to using slightly more pythonic log code --- rq/worker.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/rq/worker.py b/rq/worker.py index b7a158c..389ca77 100644 --- a/rq/worker.py +++ b/rq/worker.py @@ -10,12 +10,8 @@ except ImportError: import socket import signal import traceback +import logging from cPickle import dumps -try: - from logbook import Logger - Logger = Logger # Does nothing except it shuts up pyflakes annoying error -except ImportError: - from logging import Logger from .queue import Queue, get_failed_queue from .connections import get_current_connection from .utils import make_colorizer @@ -28,6 +24,8 @@ yellow = make_colorizer('darkyellow') red = make_colorizer('darkred') blue = make_colorizer('darkblue') +logger = logging.getLogger(__name__) + class StopRequested(Exception): pass @@ -109,7 +107,7 @@ class Worker(object): self._is_horse = False self._horse_pid = 0 self._stopped = False - self.log = Logger('worker') + self.log = logger self.failed_queue = get_failed_queue(connection=self.connection) @@ -363,7 +361,7 @@ class Worker(object): signal.signal(signal.SIGTERM, signal.SIG_DFL) self._is_horse = True - self.log = Logger('horse') + self.log = logger success = self.perform_job(job)