Skip to content

Commit 63c1b26

Browse files
author
Willem Stuursma-Ruwen
authored
Merge pull request #51 from athos-ribeiro/psr-log-3
Comply with psr/log 3
2 parents 6ff3c37 + e344556 commit 63c1b26

File tree

2 files changed

+4
-22
lines changed

2 files changed

+4
-22
lines changed

classes/mutex/RedisMutex.php

+3-21
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,21 +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-
*/
66-
public function setLogger(LoggerInterface $logger)
67-
{
68-
$this->logger = $logger;
69-
}
70-
7153
protected function acquire(string $key, int $expire): bool
7254
{
7355
// 1. This differs from the specification to avoid an overflow on 32-Bit systems.

composer.json

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

0 commit comments

Comments
 (0)