-
-
Notifications
You must be signed in to change notification settings - Fork 241
Add handler_default_channels configuration option
#454
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
|
I kinda get the problem you're trying to solve but IMO the solution is a bit unclear. Are those auto excluded channels excluded from all handlers, or only those with exclusion lists? I think it's the latter but I don't really see why.. Also name nitpick, perhaps |
5bd9dd9 to
f5cdcad
Compare
auto_excluded_channels configuration optiondefault_excluded_channels configuration option
Hi, they're excluded only from handlers with an exclusion list. I don't think it would make since for the channels to be excluded from inclusion lists since the channels in those lists are explicitly added through the configuration. I'm not sure how to make this a little more clear.
Your suggestion makes sense, I've updated the name.
Just to see if I've understood you correctly, the
In other words, if the lists are the same type, they'd get merged, otherwise, if they're not, the handlers Also, what about cases such as whitelisting a default excluded channel on some handler or blacklisting a default included one on another? Should there be some special syntax for that, eg my monolog:
default_channels: [ "!one", "!two" ]
handlers:
main:
# ...
channels: [ "!!two", "!three", "!four" ] # final list: ["!one", "!three", "!four"]or would adding a monolog:
default_channels: [ "!one", "!two" ]
handlers:
main:
# ...
use_default_channels: false
channels: [ "!one", "!three", "!four" ] # final list: ["!one", "!three", "!four"]@Seldaek Please let me know your thoughts on this and I'll update the PR accordingly. |
f5cdcad to
81c547c
Compare
default_excluded_channels configuration optionhandler_default_channels configuration option
|
I've updated the PR according to my proposal. |
81c547c to
402f0fc
Compare
cacf536 to
54049a3
Compare
54049a3 to
1173eeb
Compare
1173eeb to
58f4311
Compare
58f4311 to
558d30d
Compare
|
It seems complex to understand and perhaps a little too specific for something that can be solved with an <?php
use Symfony\Config\MonologConfig;
return static function (MonologConfig $monolog) {
$defaultChannels = ['!one', '!two', '!three'];
$monolog->handlers()->main()
->type('fingers_crossed')
->actionLevel('error')
->handler('nested')
->channels($defaultChannels);
$monolog->handlers()->nested()
->type('stream')
->path('php://stderr')
->level('debug')
->formatter('monolog.formatter.json');
$monolog->handlers()->console()
->type('console')
->processPsr3Messages(false)
->channels(['!event', '!doctrine', ...$defaultChannels]);
}; |
|
@GromNaN You make a good point. This PR was opened with YAML in mind. While |
|
The fact that we need a new Thank you for your understanding. |
When configuring multiple handlers, one annoying problem I often come across is having to add every channel that is meant to be used with a specific handler to all handlers with an exclusive list, eg:
The idea behind this PR is to be able to set a list of default channels that is applied to all handlers.
If a handler has a list of its own and it's the same type as the default one (inclusive/exclusive) the two lists are merged. If the handler's list is a different type, it replaces the default one. Handlers without lists inherit the default one. A
use_default_channelshandler option was also added so that a certain handler can choose not to use the default list.