@@ -169,7 +169,7 @@ public function work($interval = 5)
169
169
break ;
170
170
}
171
171
// If no job was found, we sleep for $interval before continuing and checking again
172
- $ this ->log ('Sleeping for ' . $ interval , true );
172
+ $ this ->log ('Sleeping for ' . $ interval , self :: LOG_VERBOSE );
173
173
if ($ this ->paused ) {
174
174
$ this ->updateProcLine ('Paused ' );
175
175
}
@@ -517,16 +517,21 @@ public function __toString()
517
517
/**
518
518
* Output a given log message to STDOUT.
519
519
*
520
- * @param string $message Message to output.
520
+ * @param string $message Message to output.
521
+ * @param int $logLevel The logging level to capture
521
522
*/
522
- public function log ($ message )
523
+ public function log ($ message, $ logLevel = self :: LOG_NORMAL )
523
524
{
524
- if ( $ this ->logLevel == self :: LOG_NORMAL ) {
525
- fwrite ( STDOUT , " *** " . $ message . "\n" ) ;
525
+ if ( $ logLevel > $ this ->logLevel ) {
526
+ return ;
526
527
}
527
- else if ($ this ->logLevel == self ::LOG_VERBOSE ) {
528
- fwrite (STDOUT , "** [ " . strftime ('%T %Y-%m-%d ' ) . "] " . $ message . "\n" );
528
+
529
+ if ($ this ->logLevel == self ::LOG_NORMAL ) {
530
+ fwrite (STDOUT , "*** " . $ message . "\n" );
531
+ return ;
529
532
}
533
+
534
+ fwrite (STDOUT , "** [ " . strftime ('%T %Y-%m-%d ' ) . "] " . $ message . "\n" );
530
535
}
531
536
532
537
/**
0 commit comments