-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[MonologBridge] Make ConsoleHandler not handle messages at SILENT verbosity
#60055
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
[MonologBridge] Make ConsoleHandler not handle messages at SILENT verbosity
#60055
Conversation
src/Symfony/Bridge/Monolog/Tests/Handler/ConsoleHandlerTest.php
Outdated
Show resolved
Hide resolved
src/Symfony/Bridge/Monolog/Tests/Handler/ConsoleHandlerTest.php
Outdated
Show resolved
Hide resolved
src/Symfony/Bridge/Monolog/Tests/Handler/ConsoleHandlerTest.php
Outdated
Show resolved
Hide resolved
src/Symfony/Bridge/Monolog/Tests/Handler/ConsoleHandlerTest.php
Outdated
Show resolved
Hide resolved
5dff435 to
dbd58bc
Compare
nicolas-grekas
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you suggesting this should be enabled by default, but we don't change it because that'd change the existing behavior?
dbd58bc to
c34db51
Compare
The existing behavior is preserved if the new |
c34db51 to
a827b61
Compare
nicolas-grekas
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/Symfony/Bridge/Monolog/Tests/Handler/ConsoleHandlerTest.php
Outdated
Show resolved
Hide resolved
cfaf929 to
156f97f
Compare
$handleSilent constructor argument to ConsoleHandlerConsoleHandler not handle messages at SILENT verbosity
ConsoleHandler not handle messages at SILENT verbosityConsoleHandler not handle messages at SILENT verbosity
156f97f to
c6bed0c
Compare
…erbosity Signed-off-by: Quentin Devos <[email protected]>
c6bed0c to
c7e655d
Compare
|
Thank you @okhoshi. |
|
Oh, this indeed was an oversight. The use-case you're describing makes perfect sense, thanks for sending in the fix! |
Original description
Adding a new constructor parameter to ConsoleHandler to let it bubble messages when the output is set at Silent verbosity level (like when using `--silent` in the CLI).
Messages are dropped by the ConsoleHandler down the line because of the verbosity, but they are considered as handled and so bubbling is interrupted if the handler is set with
$bubble = false. The use-case is to have the messages being either printed by the ConsoleHandler (and so seen by the person running the CLI) or sent to the logging system by the next handlers, but not both.Tweaking the
$verbosityLevelMapis not perfect because EMERGENCY level can never be marked as not handled.With this change, the behaviour is more consistent between Silent and Quiet verbosity levels.
Messages are dropped by the ConsoleHandler down the line because of the verbosity, but they are considered as handled and so bubbling is interrupted if the handler is set with
$bubble = false. The use-case is to have the messages being either printed by the ConsoleHandler (and so seen by the person running the CLI) or sent to the logging system by the next handlers, but not both.By not handling messages when the ConsoleHandler verbosity is set to silent, the behaviour is more consistent between, Silent and all the other verbosity levels.