From cc6975ec98e139109ede7ca270771099d6a3bfab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Fri, 29 Dec 2023 17:49:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AE=8C=E6=88=90=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E9=94=99=E8=AF=AF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- middleware/access_log.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/middleware/access_log.go b/middleware/access_log.go index 6d89e43..d5cb149 100644 --- a/middleware/access_log.go +++ b/middleware/access_log.go @@ -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 ) // 扩展数据