mirror of
https://github.com/Seldaek/monolog.git
synced 2026-04-27 16:45:50 +03:00
[GH-ISSUE #1571] About toMonologLevel() method - bug here or intentionally coded like this? #672
Labels
No labels
Bug
Documentation
Feature
Needs Work
Support
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/monolog#672
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @juan-morales on GitHub (Jul 27, 2021).
Original GitHub issue: https://github.com/Seldaek/monolog/issues/1571
Monolog version 2
File:
Logger.phpMethod:
public static function toMonologLevel($level): intI can see that passing something like
toMonologLevel("123")returns 123. PSR-3 is actually achieved (for this case) on thepublic static function getLevelName(int $level): stringwhen we throw an exception if the level is unknown.I also see that
toMonologLevel()is also used everywhere as a mechanism to get a valid monolog level (is used mainly on handlers).So ... are we missing something here? What is the point to return 123 when "123" is passd to this method?
Do we need to fix this? Please let me know I can prepare Pull-Request ASAP .... also one more question .... is
getLevelName()the right place to actually verify the level provided ???Ideas/Healthy Discussions ... welcome.
@Seldaek commented on GitHub (Sep 14, 2021):
The point is that we want to allow people extending the Logger class to provide their own levels, so unknown levels should be let through unharmed, even though it's not PSR-3 compliant. So as far as I can tell it's all fine as is.. but if you see a problem please explain :)