8000 feature #32423 [ServerBundle] Display all logs by default (lyrixx) · symfony/symfony@3e2ee71 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3e2ee71

Browse files
committed
feature #32423 [ServerBundle] Display all logs by default (lyrixx)
This PR was merged into the 4.4 branch. Discussion ---------- [ServerBundle] Display all logs by default | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #32111 | License | MIT | Doc PR | Instead of relying on `-vvv` behavior, we display all logs. End user has two ways of filtering now: * with the `--filter` options * by configuring the handler in `config/dev/monolog.yaml` Commits ------- 54b0809 [ServerBundle] Display all logs by default
2 parents c202e96 + 54b0809 commit 3e2ee71

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