-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Expand LevelEnabler interface by method Level() Level #1143
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.
Thanks for the contribution, @krupyansky, but adding a new method to an existing interface is a breaking change. We're not currently entertaining breaking changes to Zap.
If you share what problem you're trying to solve with this, we can work with you to try to find a solution to your problem.
I need an external package to be able to get the logging level from zap logger that I initialize in an internal package. For logrus, this problem is solved in the following way: I need a similar feature from zap logger. |
Add a new function LevelOf that reports the minimum enabled log level for a LevelEnabler. This works by looping through all known Zap levels in-order, returning the newly introduced UnknownLevel if none of the known levels are enabled. A LevelEnabler or Core implementation may implement the `Level() Level` method to override and optimize this behavior. AtomicLevel already implemented this method. This change adds the method to all Core implementations shipped with Zap. Note: UnknownLevel is set at FatalLevel+1 to account for the possibility that users of Zap are using DebugLevel-1 as their own custom log level--even though this isn't supported, it's preferable not to break these users. Users are less likely to use FatalLevel+1 since Fatal means "exit the application." Resolves #1144 Supersedes #1143, which was not backwards compatible
Superseded by #1147. |
Thank you for your response and feedback, @abhinav! |
Add a new function LevelOf that reports the minimum enabled log level for a LevelEnabler. This works by looping through all known Zap levels in-order, returning the newly introduced UnknownLevel if none of the known levels are enabled. A LevelEnabler or Core implementation may implement the Level() Level method to override and optimize this behavior. AtomicLevel already implemented this method. This change adds the method to all Core implementations shipped with Zap. Note: UnknownLevel is set at FatalLevel+1 to account for the possibility that users of Zap are using DebugLevel-1 as their own custom log level--even though this isn't supported, it's preferable not to break these users. Users are less likely to use FatalLevel+1 since Fatal means "exit the application." Refs #1144 Supersedes #1143, which was not backwards compatible Refs GO-1586
No description provided.