baerwang commented on code in PR #765:
URL: https://github.com/apache/dubbo-go-pixiu/pull/765#discussion_r2394814069


##########
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:
   用`zapcore.Level`判断不就好了吗,干嘛要用bool,这有点莫名其妙



-- 
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: notifications-unsubscr...@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org
For additional commands, e-mail: notifications-h...@dubbo.apache.org

Reply via email to