You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sorry I hopped late onto this thread, but I believe we shouldn't add this feature to Zap.
Allowing definitions of custom levels is a breaking change and we do not want that. See the discussions in #680.
Existing encoders and samplers could break due to such things. For example: #713 is an example of someone defining their own custom log level which broke the sampler.
Is your feature request related to a problem? Please describe.
As a user of
zap
I'd like to define my own custom log level, let's call itTraceLevel
. It's destined to be more verbose than Debug.Because currently the log levels are checked against a known, concrete set of values
zap/zapcore/level.go
Lines 134 to 156 in 4451b47
All I can get is
fmt.Sprintf("LEVEL(%d)", l)
Describe the solution you'd like
Define an interface that user defined log levels can be checked against and if they implement it then use it to get the name of the log level.
If that fails then resort to
fmt.Sprintf("LEVEL(%d)", l)
.Describe alternatives you've considered
None exist to the best of my knowledge.
Is this a breaking change?
No.
The text was updated successfully, but these errors were encountered: