8000 bug #24598 Prefer line formatter on missing cli dumper (greg0ire) · alexpott/symfony@2dc8534 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2dc8534

Browse files
bug symfony#24598 Prefer line formatter on missing cli dumper (greg0ire)
This PR was merged into the 3.3 branch. Discussion ---------- Prefer line formatter on missing cli dumper | Q | A | ------------- | --- | Branch? | 3.3 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | none, but closes symfony/recipes#145 | License | MIT | Doc PR | n/a The console formatter does a better job, unless the VarDumper component is missing, in which case the LineFormatter should be preferred. Commits ------- 574f9f5 Prefer line formatter on missing cli dumper
2 parents 0aaab05 + 574f9f5 commit 2dc8534

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Symfony/Bridge/Monolog/Handler/ConsoleHandler.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bridge\Monolog\Handler;
1313

14+
use Monolog\Formatter\LineFormatter;
1415
use Monolog\Handler\AbstractProcessingHandler;
1516
use Monolog\Logger;
1617
use Symfony\Bridge\Monolog\Formatter\ConsoleFormatter;
@@ -20,6 +21,7 @@
2021
use Symfony\Component\Console\Output\ConsoleOutputInterface;
2122
use Symfony\Component\Console\Output\OutputInterface;
2223
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
24+
use Symfony\Component\VarDumper\Dumper\CliDumper;
2325

2426
/**
2527
* Writes logs to the console output depending on its verbosity setting.
@@ -162,6 +164,9 @@ protected function write(array $record)
162164
*/
163165
protected function getDefaultFormatter()
164166
{
167+
if (!class_exists(CliDumper::class)) {
168+
return new LineFormatter();
169+
}
165170
if (!$this->output) {
166171
return new ConsoleFormatter();
167172
}

0 commit comments

Comments
 (0)
0