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


##########
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:
   我们不需要关心,如果有问题给默认就好了,剩余的让用户来解决即可



-- 
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]

Reply via email to