-
-
Notifications
You must be signed in to change notification settings - Fork 225
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
Symfony autowiring monolog channels #278 #315
Symfony autowiring monolog channels #278 #315
Conversation
- Added possibility for auto-wire monolog channels according to variable type-hint and name. Variable will have appropriated name to camel cased monolog channel service name: `monolog.logger.acme -> $monologLoggerAcme`. - Removed useless import `DefinitionDecorator`.
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.
👍 LGTM.
Could you add a note in the CHANGELOG?
It will be part of 3.5.0
Thanks
@nicolas-grekas @stof Could you review this one, please?
- Updated changelog.
@lyrixx Thanks. Now information has been add into CHANGELOG. |
I would be interested on how to use that in the README.MD since it adds great DX; (or in the Symfony documentation maybe in the monolog usage ?) |
# Conflicts: # CHANGELOG.md
Yup more docs on this would be good, if I understand correctly you can only name the variable |
Would make total sense to support only that. A full example would be nice I agree because I'm not sure when this would be useful yet :) |
@nicolas-grekas @Seldaek Hello. Just my opinion to clarify this decision. Current logic is pretty simple. A long time documentation teach us how can we find channel service in the DI container by specific logic When auto-wire has been introduce, anyone who previously solves problem with monolog channel auto-wiring, know, how exactly channel services names generates: So with new feature we are continue this logic - |
IMO naming collision protection isn't needed here as you can only collide with things of class LoggerInterface.. so the monolog name doesn't add anything. |
@Seldaek agree, so we can simplify naming according to Add the "like" to this comment if this solution acceptable. So I will update code. About documentation - I am already investigates Symfony Documentation according to all places, where would be good to add information about this new feature. |
I still find The service name convention was different, but it doesn't mean we have to carry that over to the variable name. |
@Seldaek I am OK to change as you propose. |
sorry but I don't get your point, I am only suggesting to swap these, i.e. |
@Seldaek no matter, I will change naming as you describe :) |
- Updated naming strategy. Channel 'test' become '$testLogger' and etc.
@Seldaek @nicolas-grekas Hello guys! I was finish with this PR and also create PR in symfony docs. |
- Fixed typo in the `LoggerChannelPass`. - Added separate test-case for the type-hinted aliases for each logger channel.
Thanks |
… monolog channels (adrenalinkin) This PR was merged into the 4.3 branch. Discussion ---------- [Monolog] Add documentation about how to autowire monolog channels resolved: symfony#12195 - Added documentation about how to autowire monolog channels. Relates to [Symfony autowiring monolog channels](symfony/monolog-bundle#315) Commits ------- 2e5a627 ISSUE-12195: - Added documentation about how to autowire monolog channels.
resolved #278
Variable will have appropriated name to camel cased monolog channel service name:
monolog.logger.acme -> $acmeLogger
.DefinitionDecorator
.manualchan
toadditional