-
-
Notifications
You must be signed in to change notification settings - Fork 237
Add ability to configure the PsrLogMessageProcessor #417
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
Conversation
795bb94
to
c0ea419
Compare
c0ea419
to
0d5b6a2
Compare
Thanks |
Hi, was it known that this was a Backwards breaking change ? Given the following configuration in PHP: // ./config/packages/monolog.php
use Symfony\Config\MonologConfig;
return static function (MonologConfig $config): void {
$config->handler('console')
->type('console')
->processPsr3Messages(false)
->channels()
->elements(['!event', '!doctrine']);
}; Which the signature of Updated to 3.8:
You can see the new method signature in the trace. I had to change the config to: // ./config/packages/monolog.php
use Symfony\Config\MonologConfig;
return static function (MonologConfig $config): void {
$console = $config->handler('console')
->type('console');
$console->processPsr3Messages()
->enabled(false);
$console->channels()
->elements(['!event', '!doctrine']);
}; |
Ah that's quite a surprising problem to me.. Because as I understand it this solves the BC aspect for yaml/xml/..
I am not sure if there is anything we can do to get the generated config accept booleans too? |
@Seldaek I noticed that too, but in PHP configs it would never be not an array due to the typehint. And |
I didn't take the new config builder into consideration back when I initially made this PR 😞 |
I had a quick chat with @nicolas-grekas and he agrees this is a bug in the config generator if it does not allow people to migrate configs in a BC way.. So ideally the parameter type should be removed from https://github.com/symfony/symfony/blob/5.4/src/Symfony/Component/Config/Builder/ConfigBuilderGenerator.php#L132 and perhaps other places, if anyone has time to do a PR there. I think it might be more sensible to only remove the parameter types if normalization is active on that node (which indicates some sort of BC/type juggling might be involved), but I am not sure if that's possible at all. |
I can do the PR, will open it some time today. |
If I'm not wrong, this PR symfony/symfony#44166 should have handled that case |
PR opened symfony/symfony#46328 |
…jderusse, HypeMC) This PR was merged into the 5.4 branch. Discussion ---------- [Config] Allow scalar configuration in PHP Configuration | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix symfony/monolog-bundle#417 (comment) | License | MIT | Doc PR | - Fixes passing scalar values to array nodes that have a `beforeNormalization` hook, eg: ```php return static function (MonologConfig $config): void { $config->handler('console') // ... ->processPsr3Messages() ->enabled(true) ; }; ``` can be shortened thanks to a [`beforeNormalization` hook](https://github.com/symfony/monolog-bundle/blob/a41bbcdc1105603b6d73a7d9a43a3788f8e0fb7d/DependencyInjection/Configuration.php#L453): ```php return static function (MonologConfig $config): void { $config->handler('console') // ... ->processPsr3Messages(true) ; }; ``` I've used some of the code from #44166 by `@jderusse`. Since his PR is a feature it can't go on 5.4, but it still helped a lot. Commits ------- 2d81a3a [Config] Allow scalar configuration in PHP Configuration 1c176e1 [Config] Allow scalar configuration in PHP Configuration
Adds the ability to configure the PsrLogMessageProcessor using semantic configuration.
See Seldaek/monolog#940, Seldaek/monolog#1046, Seldaek/monolog#1487.