Skip to content

Commit 14729c8

Browse files
committed
⬆️ Support psr/log 2 and 3
1 parent 5af7022 commit 14729c8

File tree

3 files changed

+10
-18
lines changed

3 files changed

+10
-18
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
*~
1+
vendor/
2+
composer.lock

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
}
1414
],
1515
"require": {
16-
"php": ">=5.3.0",
17-
"psr/log" : "~1.0"
16+
"php": "^8.0",
17+
"psr/log": "^2.0 || ^3.0"
1818
},
1919
"autoload": {
2020
"psr-0": {

src/Mouf/Utils/Log/Psr/MultiLogger.php

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,40 +16,31 @@
1616
*/
1717
class MultiLogger extends AbstractLogger
1818
{
19-
/**
20-
* @var LoggerInterface[]
21-
*/
22-
private $loggers;
19+
/** @var LoggerInterface[] */
20+
private array $loggers;
2321

2422
/**
2523
* @param LoggerInterface[] $loggers Array of loggers to be called
2624
*/
27-
public function __construct(array $loggers = array())
25+
public function __construct(array $loggers = [])
2826
{
2927
$this->loggers = $loggers;
3028
}
3129

3230
/**
3331
* Adds a logger to the list of loggers.
34-
*
35-
* @param LoggerInterface $logger
3632
*/
37-
public function addLogger(LoggerInterface $logger)
33+
public function addLogger(LoggerInterface $logger): void
3834
{
3935
$this->loggers[] = $logger;
4036
}
4137

4238
/**
43-
* Logs with an arbitrary level.
44-
*
45-
* @param mixed $level
46-
* @param string $message
47-
* @param array $context
39+
* {@inheritdoc}
4840
*/
49-
public function log($level, $message, array $context = array())
41+
public function log($level, string|\Stringable $message, array $context = []): void
5042
{
5143
foreach ($this->loggers as $logger) {
52-
/* @var $logger LoggerInterface */
5344
$logger->log($level, $message, $context);
5445
}
5546
}

0 commit comments

Comments
 (0)