This commit is contained in:
白茶清欢 2024-09-26 17:40:09 +08:00
parent 22bf77019a
commit 8ceb818a24

View File

@ -98,10 +98,10 @@ func LogRequest(cfg *AccessConfig) gin.HandlerFunc {
startRequestTime := request.WrapperHandle.GetCtxIntData(ctx, handleConfig.StartRequestTimeField, 0)
// 记录请求日志
logData := logger.NewLogData(ctx, consts.LogTypeRequest, "", map[string]any{
handleConfig.StartRequestTimeField: startRequestTime, // 开始请求时间
"request_header": getLogRequestHeader(ctx, cfg), // 请求header
"request_query": request.WrapperHandle.GetQuery(ctx), // 获取请求query
"request_body": request.WrapperHandle.GetRequestBody(ctx), // 请求body
handleConfig.StartRequestTimeField: startRequestTime, // 开始请求时间
"request_header": getLogRequestHeader(ctx, cfg), // 请求header
"request_query": request.WrapperHandle.ParseQuery(ctx), // 获取请求query
"request_body": request.WrapperHandle.ParseBody(ctx), // 请求body
})
cfg.Logger.Info("接口请求日志记录", logger.ZapLogDataList(logData)...)
ctx.Next()