Skip to content

Commit

Permalink
Drop Resque\Logger class (#77)
Browse files Browse the repository at this point in the history
* Drop Resque\Logger class

This removes the internal PSR-3 logger. Now, if no custom
logger is set up in the APP_INCLUDE, logging is disabled.

* Relax psr/log requirement so projects can use a newer version
  • Loading branch information
pprkut authored Apr 28, 2024
1 parent 81deb5b commit 4746684
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 110 deletions.
5 changes: 3 additions & 2 deletions bin/resque
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,10 @@ if($APP_INCLUDE) {
}

// See if the APP_INCLUDE containes a logger object,
// If none exists, fallback to internal logger
// If none exists, use the NullLogger instead, which
// effectively disables logging.
if (!isset($logger) || !is_object($logger)) {
$logger = new \Resque\Logger($logLevel);
$logger = new \Psr\Log\NullLogger();
}

$BLOCKING = getenv('BLOCKING') !== FALSE;
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"require": {
"php": ">=5.6.0",
"colinmollenhour/credis": "~1.7",
"psr/log": "~1.0"
"psr/log": ">=1.1.0"
},
"suggest": {
"ext-pcntl": "REQUIRED for forking processes on platforms that support it (so anything but Windows).",
Expand Down
69 changes: 0 additions & 69 deletions lib/Logger.php

This file was deleted.

4 changes: 2 additions & 2 deletions lib/Worker/ResqueWorker.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

namespace Resque\Worker;

use Resque\Logger;
use Resque\Resque;
use CredisException;
use Psr\Log\LogLevel;
use Psr\Log\NullLogger;
use Resque\Job\PID;
use Resque\Event;
use Resque\Exceptions\DirtyExitException;
Expand Down Expand Up @@ -91,7 +91,7 @@ class ResqueWorker
*/
public function __construct($queues)
{
$this->logger = new Logger();
$this->logger = new NullLogger();

if (!is_array($queues)) {
$queues = array($queues);
Expand Down
36 changes: 0 additions & 36 deletions test/Resque/Tests/LoggerTest.php

This file was deleted.

0 comments on commit 4746684

Please sign in to comment.