Closed stonebirdjx closed 1 month ago
This issue has been marked as invalid question, please give more information by following the issue
template. The issue will be closed in 1 days if no further activity occurs.
cc @rogerogers
本地复现
package main
import (
"context"
"github.com/cloudwego/hertz/pkg/common/hlog"
hertzzap "github.com/hertz-contrib/logger/zap"
)
func main() {
logger := hertzzap.NewLogger()
hlog.SetLogger(logger)
hlog.SetLevel(hlog.LevelInfo)
hlog.CtxInfof(context.Background(), "hello %s", "hertz")
hlog.CtxDebugf(context.Background(), "hello %s", "hertz")
logger.Sync()
}
output:
{"level":"info","ts":1719048778.078252,"msg":"hello hertz"}
一切正常
没理解啥意思,等级判断是通过 level 的 Enabled 方法判断的,如果有必要可以自定义这个方法的逻辑
This issue has been marked as invalid question, please give more information by following the issue
template. The issue will be closed in 1 days if no further activity occurs.
理解了,感谢反馈,做了一版修正
👍,感谢采纳,果然是中国速度
This issue has been marked as invalid question, please give more information by following the issue
template. The issue will be closed in 1 days if no further activity occurs.
打印日志时能不能先判断日志级别呢? 设置info级别后, 分析pprof 还有CtxDebugf的性能消耗