-
-
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
feat(PsrLoggerAdapter): Allow to use Psr\Log\LogLevel
for log
method
#47293
Conversation
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’m not sure I get the point, those const are strings and not int, so we will still not be able to use them instead of the ILogger ones?
The problem is that there is no standard for int levels.
We should host those const elsewhere or undeprecate them in my opinion. But core and apps need a way to reference log levels by name.
Should we add a backed enum in OCP for that 🤓 ?
Well this adds support so that you can call: LoggerInterface $logger;
// ...
$logger->log(LogLevel::WARNING, 'this is a warning')
$logger->log(LogLevel::DEBUG, 'this is a debug message') So everywhere¹² you use the ¹ Well not if directly using the |
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.
Thanks! This is great when passing our logger instance into a library that speaks to psr/log but obviously has no idea about our constants
There is less usage of those consts than I thought. I was expecting to find a lot of |
34accb6
to
02e9c30
Compare
There is the `Psr\Log\LogLevel` class defining loglevel constants, to be fully compatible we should at least support those logging levels. Moreover this is the last part that was still required from `ILogger` interface, as we did not have alternatives for the loglevel constants. Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
02e9c30
to
81df2d2
Compare
Summary
There is the
Psr\Log\LogLevel
class defining log level constants, to be fully compatible we should at least support those logging levels. Moreover this is the last part that was still required fromILogger
interface, as we did not have alternatives for the log level constants.Checklist