请求结果命中缓存, 记录响应日志
This commit is contained in:
@ -58,8 +58,8 @@ func GetBuildDataFunc() BuildHttpLogDataFunc {
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 18:07 2025/3/31
|
||||
func Record(ctx context.Context, logInstance *zap.Logger, level consts.LogLevel, msg string, reqCfg *define.Request, response *define.Response) {
|
||||
if nil == logInstance {
|
||||
func Record(level consts.LogLevel, msg string, reqCfg *define.Request, response *define.Response) {
|
||||
if nil == reqCfg.Logger {
|
||||
// 未设置日志实例
|
||||
return
|
||||
}
|
||||
@ -68,7 +68,8 @@ func Record(ctx context.Context, logInstance *zap.Logger, level consts.LogLevel,
|
||||
// 未设置构建日志数据的方法
|
||||
return
|
||||
}
|
||||
fields := buildDataFunc(ctx, true, nil, reqCfg, response)
|
||||
fields := buildDataFunc(reqCfg.Ctx, true, nil, reqCfg, response)
|
||||
logInstance := reqCfg.Logger
|
||||
switch level {
|
||||
case consts.LogLevelDebug:
|
||||
logInstance.Debug(msg, fields...)
|
||||
|
Reference in New Issue
Block a user