-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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 a PSR-3 logger adapter and make it injectable #18200
Conversation
PHP-FIG is currently working on adding types to existing PSRs php-fig/fig-standards#1195 Don't know if there is any plan when it will be there, just wanted to mention that |
Thanks a lot for this info. I wasn't aware of that. Then let's wait a bit until this has settled. |
Still no 2.0 🤷♂️ |
do we want to wait? |
This comment has been minimized.
This comment has been minimized.
109dbb7
to
040cb2e
Compare
Errrrr actually we can't. You can have a broader (super) type as hint, but you can't put |
040cb2e
to
e4d3669
Compare
e4d3669
to
c80d1bd
Compare
c80d1bd
to
8fc6618
Compare
This comment has been minimized.
This comment has been minimized.
Yeah, I was about to say that. our logger is supposed to be compatible. So I'd say we either remove the type hints for now, or we wait until PSR added them? |
This comment has been minimized.
This comment has been minimized.
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
8fc6618
to
1b4380a
Compare
Still no 2.0, so this won't be typed right now. But we can tighten later as you said. Let's do this :) |
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.
Fine by me and seems to be additional on top?
Should we ask people to use that instead?
Yes, right now our logging stays untouched.
Let's maybe wait a bit for the typed interface. I hope this lands soon-ish. Then we can advertise the PSR logger more. |
Stumbled over https://www.php-fig.org/psr/psr-3/ because I'm writing a php library that I would like to make Nextcloud-agnostic. To be able to use a logger in the library, I chose to use the PSR-3 standard and inject a tiny adapter.
I figured it would make sense to have this in our code base. This smoothens the integration of 3rd party libraries.
Adding the interface as base of our ILogger is not possible as we have
string
type hints on the messages, whereas the PSR3 interface only has documented types.