Skip to content

Commit 8fba9cc

Browse files
melquchiri-tbdo-iegorov
authored andcommitted
Adapt module with new version of monolog
1 parent 7ce0390 commit 8fba9cc

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

src/Migration/Logger/ConsoleHandler.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Monolog\Handler\HandlerInterface;
1111
use Monolog\Handler\AbstractHandler;
1212
use Psr\Log\LogLevel;
13+
use Monolog\LogRecord;
1314

1415
/**
1516
* Processing logger handler creation for migration application
@@ -46,7 +47,7 @@ protected function colorize($string, $color)
4647
/**
4748
* @inheritdoc
4849
*/
49-
public function handle(array $record): bool
50+
public function handle(LogRecord $record): bool
5051
{
5152
if (!$this->isHandling($record)) {
5253
return false;

src/Migration/Logger/FileHandler.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Magento\Framework\App\Filesystem\DirectoryList;
1111
use Monolog\Formatter\FormatterInterface;
1212
use Monolog\Handler\HandlerInterface;
13+
use Monolog\LogRecord;
1314

1415
/**
1516
* Processing logger handler creation for migration application
@@ -59,7 +60,7 @@ public function __construct(File $file, Config $config, \Magento\Framework\Files
5960
/**
6061
* @inheritdoc
6162
*/
62-
public function handle(array $record): bool
63+
public function handle(LogRecord $record): bool
6364
{
6465
if (!$this->isHandling($record)) {
6566
return false;

src/Migration/Logger/Logger.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66

77
namespace Migration\Logger;
88

9-
use Monolog\DateTimeImmutable;
9+
use Monolog\JsonSerializableDateTimeImmutable;
10+
use Monolog\Level;
1011

1112
/**
1213
* Processing logger handler creation for migration application
@@ -33,7 +34,8 @@ public function __construct($name = 'Migration', array $handlers = [], array $pr
3334
/**
3435
* @inheritdoc
3536
*/
36-
public function addRecord(int $level, string $message, array $context = [], DateTimeImmutable $datetime = null): bool
37+
38+
public function addRecord(int|Level $level, string $message, array $context = [], JsonSerializableDateTimeImmutable|null $datetime = null): bool
3739
{
3840
$processed = parent::addRecord($level, $message, $context);
3941
self::$messages[$level][] = $message;

src/Migration/Logger/MessageFormatter.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*/
66
namespace Migration\Logger;
77

8+
use Monolog\LogRecord;
9+
810
/**
911
* Format logger messages corresponding to verbosity level
1012
*/
@@ -13,12 +15,12 @@ class MessageFormatter extends \Monolog\Formatter\LineFormatter implements \Mono
1315
/**
1416
* @inheritdoc
1517
*/
16-
protected $format;
18+
protected string $format;
1719

1820
/**
1921
* @inheritdoc
2022
*/
21-
public function format(array $record): string
23+
public function format(LogRecord $record): string
2224
{
2325
$this->format = $this->getLevelFormat($record['level_name']);
2426
return parent::format($record);

0 commit comments

Comments
 (0)