From 02cd41a00952c58e39e7ace287153ae18b8c1140 Mon Sep 17 00:00:00 2001 From: JellyTony Date: Fri, 27 Sep 2024 10:46:54 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20err=20=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E6=89=93=E5=8D=B0=E8=AF=B7=E6=B1=82=E5=92=8C=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- middleware/logging/logging.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/middleware/logging/logging.go b/middleware/logging/logging.go index bb705e5..4431190 100644 --- a/middleware/logging/logging.go +++ b/middleware/logging/logging.go @@ -204,10 +204,10 @@ func Client(opts ...Option) middleware.Middleware { "duration": timex.Duration(duration), "callee_service": callee, } - if cfg.dumpReq { + if cfg.dumpReq || err != nil { fields["request"] = extractArgs(req) } - if cfg.dumpResp { + if cfg.dumpResp || err != nil { fields["response"] = extractArgs(resp) } if nodeAddress != "" { @@ -354,10 +354,10 @@ func Server(opts ...Option) middleware.Middleware { "duration": timex.Duration(duration), "caller_service": caller, } - if cfg.dumpReq { + if cfg.dumpReq || err != nil { fields["request"] = extractArgs(req) } - if cfg.dumpResp { + if cfg.dumpResp || err != nil { fields["response"] = extractArgs(resp) } if se := errors.FromError(err); se != nil {