Skip to content

Commit 0196872

Browse files
committed
bug symfony#52222 [MonologBridge] Fix support for monolog 3.0 (louismariegaborit)
This PR was squashed before being merged into the 6.3 branch. Discussion ---------- [MonologBridge] Fix support for monolog 3.0 | Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | | License | MIT `handle` function in HandlerInterface supports only LogRecord argument in monolog 3.0. Commits ------- 3aacc28 [MonologBridge] Fix support for monolog 3.0
2 parents 4b99e60 + 3aacc28 commit 0196872

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/Symfony/Bridge/Monolog/Command/ServerLogCommand.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313

1414
use Monolog\Formatter\FormatterInterface;
1515
use Monolog\Handler\HandlerInterface;
16+
use Monolog\Level;
1617
use Monolog\Logger;
18+
use Monolog\LogRecord;
1719
use Symfony\Bridge\Monolog\Formatter\ConsoleFormatter;
1820
use Symfony\Bridge\Monolog\Handler\ConsoleHandler;
1921
use Symfony\Component\Console\Attribute\AsCommand;
@@ -156,6 +158,16 @@ private function displayLog(OutputInterface $output, int $clientId, array $recor
156158
$logBlock = sprintf('<bg=%s> </>', self::BG_COLOR[$clientId % 8]);
157159
$output->write($logBlock);
158160

161+
if (Logger::API >= 3) {
162+
$record = new LogRecord(
163+
$record['datetime'],
164+
$record['channel'],
165+
Level::fromValue($record['level']),
166+
$record['message'],
167+
$record['context']->getContext(),
168+
);
169+
}
170+
159171
$this->handler->handle($record);
160172
}
161173
}

0 commit comments

Comments
 (0)