mirror of
https://github.com/idanoo/php-resque.git
synced 2024-11-22 08:15:14 +00:00
Merge pull request #90 from cballou/master
Fixed Resque_Worker logging as it would always output verbose messaging.
This commit is contained in:
commit
c18b5441f5
@ -169,7 +169,7 @@ class Resque_Worker
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// If no job was found, we sleep for $interval before continuing and checking again
|
// If no job was found, we sleep for $interval before continuing and checking again
|
||||||
$this->log('Sleeping for ' . $interval, true);
|
$this->log('Sleeping for ' . $interval, self::LOG_VERBOSE);
|
||||||
if($this->paused) {
|
if($this->paused) {
|
||||||
$this->updateProcLine('Paused');
|
$this->updateProcLine('Paused');
|
||||||
}
|
}
|
||||||
@ -517,16 +517,21 @@ class Resque_Worker
|
|||||||
/**
|
/**
|
||||||
* Output a given log message to STDOUT.
|
* Output a given log message to STDOUT.
|
||||||
*
|
*
|
||||||
* @param string $message Message to output.
|
* @param string $message Message to output.
|
||||||
|
* @param int $logLevel The logging level to capture
|
||||||
*/
|
*/
|
||||||
public function log($message)
|
public function log($message, $logLevel = self::LOG_NORMAL)
|
||||||
{
|
{
|
||||||
if($this->logLevel == self::LOG_NORMAL) {
|
if ($logLevel > $this->logLevel) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->logLevel == self::LOG_NORMAL) {
|
||||||
fwrite(STDOUT, "*** " . $message . "\n");
|
fwrite(STDOUT, "*** " . $message . "\n");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else if($this->logLevel == self::LOG_VERBOSE) {
|
|
||||||
fwrite(STDOUT, "** [" . strftime('%T %Y-%m-%d') . "] " . $message . "\n");
|
fwrite(STDOUT, "** [" . strftime('%T %Y-%m-%d') . "] " . $message . "\n");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user