8000 [ServerBundle] Display all logs by default · symfony/symfony@54b0809 · GitHub
[go: up one dir, main page]

Skip to content

Commit 54b0809

Browse files
committed
[ServerBundle] Display all logs by default
Instead of relying on `-vvv` behavior, we display all logs. End user has two ways of filtering now (instead of 3 previously): * with the `--filter` options * by configuring the handler in `config/dev/monolog.yaml`
1 parent 6811aaa commit 54b0809

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/Symfony/Bundle/WebServerBundle/Command/ServerLogCommand.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Bundle\WebServerBundle\Command;
1313

1414
use Monolog\Formatter\FormatterInterface;
15+
use Monolog\Logger;
1516
use Symfony\Bridge\Monolog\Formatter\ConsoleFormatter;
1617
use Symfony\Bridge\Monolog\Handler\ConsoleHandler;
1718
use Symfony\Component\Console\Command\Command;
@@ -85,7 +86,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
8586
$this->el = new ExpressionLanguage();
8687
}
8788

88-
$this->handler = new ConsoleHandler($output);
89+
$this->handler = new ConsoleHandler($output, true, [
90+
OutputInterface::VERBOSITY_NORMAL => Logger::DEBUG,
91+
]);
8992

9093
$this->handler->setFormatter(new ConsoleFormatter([
9194
'format' => str_replace('\n', "\n", $input->getOption('format')),
@@ -143,13 +146,11 @@ private function getLogs($socket)
143146

144147
private function displayLog(InputInterface $input, OutputInterface $output, $clientId, array $record)
145148
{
146-
if ($this->handler->isHandling($record)) {
147-
if (isset($record['log_id'])) {
148-
$clientId = unpack('H*', $record['log_id'])[1];
149-
}
150-
$logBlock = sprintf('<bg=%s> </>', self::$bgColor[$clientId % 8]);
151-
$output->write($logBlock);
149+
if (isset($record['log_id'])) {
150+
$clientId = unpack('H*', $record['log_id'])[1];
152151
}
152+
$logBlock = sprintf('<bg=%s> </>', self::$bgColor[$clientId % 8]);
153+
$output->write($logBlock);
153154

154155
$this->handler->handle($record);
155156
}

0 commit comments

Comments
 (0)
0