From 5cef885a0602d7c09f53e81baeb05529e6676e90 Mon Sep 17 00:00:00 2001 From: Rockstar04 Date: Tue, 25 Jun 2013 12:10:08 -0700 Subject: [PATCH] Look for a var in the bin/resque script to allow override --- bin/resque | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/bin/resque b/bin/resque index 890c529..b9a10cf 100755 --- a/bin/resque +++ b/bin/resque @@ -50,8 +50,6 @@ else if(!empty($VVERBOSE)) { $logLevel = true; } -$logger = new Resque_Log($logLevel); - $APP_INCLUDE = getenv('APP_INCLUDE'); if($APP_INCLUDE) { if(!file_exists($APP_INCLUDE)) { @@ -61,6 +59,12 @@ if($APP_INCLUDE) { require_once $APP_INCLUDE; } +// See if the APP_INCLUDE containes a logger object, +// If none exists, fallback to internal logger +if (!isset($logger) && !is_object($logger)) { + $logger = new Resque_Log($logLevel); +} + $BLOCKING = getenv('BLOCKING') !== FALSE; $interval = 5; @@ -92,7 +96,7 @@ if($count > 1) { else if(!$pid) { $queues = explode(',', $QUEUE); $worker = new Resque_Worker($queues); - $worker->setLogger(new Resque_Log($logLevel)); + $worker->setLogger($logger); $logger->log(Psr\Log\LogLevel::NOTICE, 'Starting worker {worker}', array('worker' => $worker)); $worker->work($interval, $BLOCKING); break; @@ -103,7 +107,7 @@ if($count > 1) { else { $queues = explode(',', $QUEUE); $worker = new Resque_Worker($queues); - $worker->setLogger(new Resque_Log($logLevel)); + $worker->setLogger($logger); $PIDFILE = getenv('PIDFILE'); if ($PIDFILE) {