mirror of
https://github.com/Seldaek/monolog.git
synced 2026-04-26 16:15:49 +03:00
[GH-ISSUE #1667] v3: Consider merging Level and LevelName enums #710
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#710
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 @tigitz on GitHub (May 9, 2022).
Original GitHub issue: https://github.com/Seldaek/monolog/issues/1667
Parsing v3 code I feel like splitting the level name in it's own Enum doesn't bring any benefit while on the contrary it adds complexity and probably confusion for users.
They will have to constantly think about which one they should use in their context while in fact all they want is to use a Level. The name is just a property of the Level, the same way the
intvalue is.Could merging both enums into a single
Levelenum be considered an improvement ?Something like this:
Difference between current and supposedly improved usage:
Current version
Improved version
@Seldaek commented on GitHub (May 9, 2022):
Yeah that sounds like an idea. The only downside is you don't have enum cases for level names anymore then, but in practice looking at the code now that it's all been converted we only ever refer to levelName->value, so Level->getName() would be just as good, and LevelName::VALUES could be Level::NAMES too.
I think I'll do the change.
Monolog\Formatter\JsonFormatter#1309