Alanxtl commented on code in PR #765:
URL: https://github.com/apache/dubbo-go-pixiu/pull/765#discussion_r2404235854
##########
pkg/logger/controller.go:
##########
@@ -104,26 +102,24 @@ func (c *logController) errorf(fmt string, args ...any) {
c.logger.Errorf(fmt, args...)
}
-// parseLevel is used to parse the level of the log.
-func (c *logController) parseLevel(level string) *zap.AtomicLevel {
- var lvl zapcore.Level
+// parseLevel parses textual level to zapcore.Level.
+func (c *logController) parseLevel(level string) (zapcore.Level, bool) {
switch strings.ToLower(level) {
case "debug":
- lvl = zapcore.DebugLevel
+ return zapcore.DebugLevel, true
case "info":
- lvl = zapcore.InfoLevel
- case "warn":
- lvl = zapcore.WarnLevel
+ return zapcore.InfoLevel, true
+ case "warn", "warning":
+ return zapcore.WarnLevel, true
case "error":
- lvl = zapcore.ErrorLevel
+ return zapcore.ErrorLevel, true
+ case "dpanic":
+ return zapcore.DPanicLevel, true
case "panic":
- lvl = zapcore.PanicLevel
+ return zapcore.PanicLevel, true
case "fatal":
- lvl = zapcore.FatalLevel
+ return zapcore.FatalLevel, true
default:
- return nil
+ return zapcore.InfoLevel, false
Review Comment:
done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]