Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Prefer line formatter on missing cli dumper #24598

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prefer line formatter on missing cli dumper
The console formatter does a better job, unless the VarDumper component
is missing, in which case you will not see the "context" or "extra" keys
and the LineFormatter should be preferred.
  • Loading branch information
greg0ire committed Oct 17, 2017
commit 574f9f52736c17804848bd1481d9c1d23c872e7c
5 changes: 5 additions & 0 deletions 5 src/Symfony/Bridge/Monolog/Handler/ConsoleHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace Symfony\Bridge\Monolog\Handler;

use Monolog\Formatter\LineFormatter;
use Monolog\Handler\AbstractProcessingHandler;
use Monolog\Logger;
use Symfony\Bridge\Monolog\Formatter\ConsoleFormatter;
Expand All @@ -20,6 +21,7 @@
use Symfony\Component\Console\Output\ConsoleOutputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\VarDumper\Dumper\CliDumper;

/**
* Writes logs to the console output depending on its verbosity setting.
Expand Down Expand Up @@ -162,6 +164,9 @@ protected function write(array $record)
*/
protected function getDefaultFormatter()
{
if (!class_exists(CliDumper::class)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not find a way to test this (other than change the namespace of the test to match the one of the class but I'm don't think that would be ok with you).

return new LineFormatter();
}
if (!$this->output) {
return new ConsoleFormatter();
}
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.