修复完成时间错误问题

This commit is contained in:
白茶清欢 2023-12-29 17:49:24 +08:00
parent f787899725
commit cc6975ec98

View File

@ -108,10 +108,10 @@ func Access(cfg *AccessConfig) gin.HandlerFunc {
finishRequestTime := wrapper.OwnTime(ctx.GetTime(define.FinishRequestTimeField))
logDataList = append(
logDataList,
zap.Any(define.FinishRequestTimeField, startRequestTime.FormatUnixMilli()),
zap.Int64("pkg_gin_request_cost", finishRequestTime.UnixMilli()-startRequestTime.UnixMilli()),
zap.Any("pkg_gin_request_header", getLogRequestHeader(ctx, cfg)),
zap.Any("pkg_gin_response_header", getLogResponseHeader(ctx, cfg)),
zap.Any(define.FinishRequestTimeField, finishRequestTime.FormatUnixMilli()), // 请求完成时间
zap.Int64("pkg_gin_request_cost", finishRequestTime.UnixMilli()-startRequestTime.UnixMilli()), // 接口耗时
zap.Any("pkg_gin_request_header", getLogRequestHeader(ctx, cfg)), // 请求header
zap.Any("pkg_gin_response_header", getLogResponseHeader(ctx, cfg)), // 响应header
)
// 扩展数据