Skip to content

Commit e344556

Browse files
author
Willem Stuursma
committed
Allow newer versions of psr/log
1 parent 5640e8a commit e344556

File tree

2 files changed

+4
-23
lines changed

2 files changed

+4
-23
lines changed

classes/mutex/RedisMutex.php

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use malkusch\lock\exception\LockAcquireException;
88
use malkusch\lock\exception\LockReleaseException;
99
use Psr\Log\LoggerAwareInterface;
10-
use Psr\Log\LoggerInterface;
10+
use Psr\Log\LoggerAwareTrait;
1111
use Psr\Log\NullLogger;
1212

1313
/**
@@ -21,6 +21,8 @@
2121
*/
2222
abstract class RedisMutex extends SpinlockMutex implements LoggerAwareInterface
2323
{
24+
use LoggerAwareTrait;
25+
2426
/**
2527
* @var string The random value token for key identification.
2628
*/
@@ -31,11 +33,6 @@ abstract class RedisMutex extends SpinlockMutex implements LoggerAwareInterface
3133
*/
3234
private $redisAPIs;
3335

34-
/**
35-
* @var LoggerInterface The logger.
36-
*/
37-
private $logger;
38-
3936
/**
4037
* Sets the Redis APIs.
4138
*
@@ -53,22 +50,6 @@ public function __construct(array $redisAPIs, string $name, int $timeout = 3)
5350
$this->logger = new NullLogger();
5451
}
5552

56-
/**
57-
* Sets a logger instance on the object
58-
*
59-
* RedLock is a fault tolerant lock algorithm. I.e. it does tolerate
60-
* failing redis connections without breaking. If you want to get notified
61-
* about such events you'll have to provide a logger. Those events will
62-
* be logged as warnings.
63-
*
64-
* @param LoggerInterface $logger The logger.
65-
* @return void.
66-
*/
67-
public function setLogger(LoggerInterface $logger): void
68-
{
69-
$this->logger = $logger;
70-
}
71-
7253
protected function acquire(string $key, int $expire): bool
7354
{
7455
// 1. This differs from the specification to avoid an overflow on 32-Bit systems.

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
},
4444
"require": {
4545
"php": "^7.2 || ^8.0",
46-
"psr/log": "^3"
46+
"psr/log": "^1|^2|^3"
4747
},
4848
"require-dev": {
4949
"ext-memcached": "*",

0 commit comments

Comments
 (0)