AlexStocks commented on code in PR #3195:
URL: https://github.com/apache/dubbo-go/pull/3195#discussion_r2899089362
##########
logger/core/zap/zap.go:
##########
@@ -84,7 +84,15 @@ func instantiate(config *common.URL) (log logger.Logger, err
error) {
log = zap.New(zapcore.NewCore(
encoder, zapcore.NewMultiWriteSyncer(sync...), zapAtomicLevel,
), zap.AddCaller(), zap.AddCallerSkip(1)).Sugar()
- return &dubbogoLogger.DubboLogger{Logger: log, DynamicLevel:
zapAtomicLevel}, nil
+
+ baseLogger := &dubbogoLogger.DubboLogger{Logger: log, DynamicLevel:
zapAtomicLevel}
+ traceEnabled := config.GetParamBool(constant.LoggerTraceEnabledKey,
false)
+ if traceEnabled {
+ recordErrorToSpan :=
config.GetParamBool(constant.LoggerTraceRecordErrorKey, true)
+ return NewZapCtxLogger(baseLogger, recordErrorToSpan), nil
Review Comment:
`ZapCtxLogger` 没有实现 `OpsLogger` 接口(`SetLoggerLevel(string)
bool`)。`logger.go` 中的类型断言 `if l, ok := logger.(OpsLogger); ok` 会失败,开启 trace
后动态调整日志级别的功能静默失效,没有任何报错。
建议:`ZapCtxLogger` 实现 `SetLoggerLevel`,委托给内部的 `DubboLogger`。
--
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]