-
-
Notifications
You must be signed in to change notification settings - Fork 4
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
Stop assuming LogLevel::*
levels, because \Psr\Log\LoggerInterface::log()
does not require it either
#2
Comments
PR opened! Test coverage should be expanded, but I first would like a +1 from you on the approach 😊 🙏 |
👋 I'm very much in favor of removing this faulty assumption from this library, even if that does require a major version bump. Using a level map makes sense to me, so I think your PR is on the right track! I do wonder if we should also use this opportunity to fully standardize how we use Open to your thoughts here! I'll also leave a couple other notes on your PR :) |
Technically floats, bools and nulls can also be supplied as array keys, they get cast to strings or ints. |
True, but the challenge becomes differentiating between |
If I'm understanding this right @colinodell, you've ended up suggesting that we don't need to relatively complicated level map approach proposed by @wimleers , and instead we can just replace all the As far as I can see the only drawback to this is that the magic |
Actually there is an easy solution. I've opened a new PR #3 which |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Still relevant
…On Mon, 6 Mar 2023, 23:41 stale[bot], ***@***.***> wrote:
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
—
Reply to this email directly, view it on GitHub
<#2 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA2ZQQLP6UJZ7Q2VAKTSXZDW2ZY3RANCNFSM6AAAAAAS7VZ53I>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
v1.2.0 has been released with support for both Thanks for opening this issue and contributing the changes :D |
👋
We're looking into adopting this in Drupal over at https://www.drupal.org/project/drupal/issues/3321905.
However, we ran into a blocker. We have to do write code like
… because this package assumes the level is always a
string
, specifically one ofLogLevel::*
(although that's not enforced, but just prescribed by the documentation).But
\Psr\Log\LoggerInterface::log()
prescribes onlymixed $level
. And the Drupal logging implementation (\Drupal\Core\Logger\LoggerChannel::log()
) stores integers, not strings:… which means that we unfortunately cannot actually use
colinodell/psr-testlogger
, except in the awkward way shown above. It also means that we can never use the nicer accessors such ashasErrorThatContains()
etc.Therefore I propose to optionally allow specifying a mapping of
LogLevel::*
strings to alternative values (in our case: RFC 5424-compliant integers). This would present no BC break; it would be entirely optional.The text was updated successfully, but these errors were encountered: