[Console] Added standalone PSR-3 compliant logger#10194
[Console] Added standalone PSR-3 compliant logger#10194fabpot merged 1 commit intosymfony:masterfrom
Conversation
There was a problem hiding this comment.
it should be an optional dependency
|
the message should not always been written IMO. A message at the debug level should not be written in normal verbosity (see how the Monolog ConsoleHandler handles it) |
|
@stof Thanks for your review. I agree with the verbosity handling. |
|
All reports of @stof closed and verbosity system added. I'm not sure about this map: https://github.com/symfony/symfony/pull/10194/files#diff-84e574ab0bb629e124c5752bb81259ccR37 |
There was a problem hiding this comment.
to be consistent with the Monolog ConsoleHandler in the bridge, this should be at the normal verbosity
|
Why |
|
Changes done. |
There was a problem hiding this comment.
Using !isset($this->verbosityLevelMap[$level]) would require less computation.
|
Added a way to configure the format (similar to how configuring the verbosity works). |
There was a problem hiding this comment.
shouldn't this be an OutOfBoundsException ?
There was a problem hiding this comment.
The InvalidArgumentException in defined in PSR-3
|
@dunglas To be exact, |
|
@stof yes I would "say equivalent" here because keys are strings. |
|
Is this PR ready to be merged? Can I start working on the PR in the doc? |
There was a problem hiding this comment.
This class should be moved on the Fixtures namespace?
|
|
|
@dunglas We need the PR for the documentation before merging the PR. |
|
Fine. I'll do it ASAP. |
|
@dunglas Any news on the docs? We need to finish this ASAP to be able to merge this PR before 2.5. |
There was a problem hiding this comment.
better leave line breaks here?
|
nice contribution, this is exactly what i need, if you work on a documentation PR maybe it would be good to do a cookbook? 👶, what do you think about wrapping your ConsoleLogger into a helper, or it is not important? |
|
@dunglas As soon as you can create the PR on the docs, please reference it here and we will be good to merge. |
There was a problem hiding this comment.
this should write error messages to the error output. see https://github.com/symfony/symfony/blob/master/src/Symfony/Bridge/Monolog/Handler/ConsoleHandler.php#L153
This PR adds a standalone, PSR-3 compliant, logger to the Console component. It logs all messages on the console output. Messages of
DEBUG,INFOandNOTICElevels are displayed using theinfoformat (default to green). Higher levels are displayed using theerrorformatter (default to red).This logger is similar to the Monolog's Console Handler but does not have any external dependency (except
php-fig/log). This is useful for console applications and commands needing a lightweight PSR-3 compliant logger (e.g. required by a dependency or to display basic informations to the user).An usage example is available here: https://github.com/dunglas/php-schema.org-model/blob/master/src/SchemaOrgModel/Command/GenerateEntitiesCommand.php#L71