|
13 | 13 |
|
14 | 14 | use Monolog\Formatter\FormatterInterface;
|
15 | 15 | use Monolog\Handler\HandlerInterface;
|
| 16 | +use Monolog\Level; |
16 | 17 | use Monolog\Logger;
|
| 18 | +use Monolog\LogRecord; |
17 | 19 | use Symfony\Bridge\Monolog\Formatter\ConsoleFormatter;
|
18 | 20 | use Symfony\Bridge\Monolog\Handler\ConsoleHandler;
|
19 | 21 | use Symfony\Component\Console\Attribute\AsCommand;
|
@@ -119,6 +121,16 @@ protected function execute(InputInterface $input, OutputInterface $output): int
|
119 | 121 | continue;
|
120 | 122 | }
|
121 | 123 |
|
| 124 | + if (Logger::API >= 3) { |
| 125 | + $record = new LogRecord( |
| 126 | + level: Level::fromValue($record['level']), |
| 127 | + channel: $record['channel'], |
| 128 | + context: $record['context']->getContext(), |
| 129 | + datetime: $record['datetime'], |
| 130 | + message: $record['message'], |
| 131 | + ); |
| 132 | + } |
| 133 | + |
122 | 134 | $this->displayLog($output, $clientId, $record);
|
123 | 135 | }
|
124 | 136 |
|
@@ -148,7 +160,7 @@ private function getLogs($socket): iterable
|
148 | 160 | }
|
149 | 161 | }
|
150 | 162 |
|
151 |
| - private function displayLog(OutputInterface $output, int $clientId, array $record): void |
| 163 | + private function displayLog(OutputInterface $output, int $clientId, array|LogRecord $record): void |
152 | 164 | {
|
153 | 165 | if (isset($record['log_id'])) {
|
154 | 166 | $clientId = unpack('H*', $record['log_id'])[1];
|
|
0 commit comments