-
-
Notifications
You must be signed in to change notification settings - Fork 232
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
Add support for the #[WithMonologChannel]
attribute of Monolog 3.5 to autoconfigure the channel
#468
Conversation
#[WithLoggerChannel]
attribute to autoconfigure the channel
5d23509
to
db43862
Compare
db43862
to
e9e0f98
Compare
Attribute/WithLoggerChannel.php
Outdated
/** | ||
* @readonly | ||
*/ | ||
public string $channel; |
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.
public string $channel; | |
public $channel; |
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.
IMO, it is fine to keep the typed property there. Attributes don't work on PHP 7.2 anyway
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.
why not using CPP then?
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.
ah indeed. For some reasons, I thought CPP was 8.1 like the readonly properties.
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.
👍🏼 I like it
Can we please write tests for that? And should we move the attribute to the bridge? |
Or better: to monolog itself? We already have https://github.com/Seldaek/monolog/blob/main/src/Monolog/Attribute/AsMonologProcessor.php |
e9e0f98
to
618f2e6
Compare
@Seldaek do you think this attribute should go in Monolog itself ? |
I submitted it to Monolog in Seldaek/monolog#1847 |
618f2e6
to
0669745
Compare
#[WithLoggerChannel]
attribute to autoconfigure the channel#[WithMonologChannel]
attribute of Monolog 3.5 to autoconfigure the channel
Configuring custom channels on some services is one of the last reasons I have for defining services explicitly in my config files. This attribute allows to solve that.