From 3b335785a4176a7150023d5205244712d35456bf Mon Sep 17 00:00:00 2001 From: yuguojian <18126816215> Date: Wed, 14 May 2025 09:49:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=97=A5=E5=BF=97=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- log/log.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/log/log.go b/log/log.go index 4181be8..db95e4d 100644 --- a/log/log.go +++ b/log/log.go @@ -114,3 +114,23 @@ func GFFatal(ctx context.Context, log *LogInfo) { handleLog(log) g.Log().Fatal(ctx, log) } + +func (l *LogInfo) GFCommonHandelResult(ctx context.Context, result interface{}, err error) { + if err != nil { + l.Result = err + GFError(ctx, l) + } else { + l.Result = result + GFInfo(ctx, l) + } +} + +func (l *LogInfo) ZapCommonHandelResult(logger *zap.Logger, result interface{}, err error) { + if err != nil { + l.Result = err + ZapError(logger, l) + } else { + l.Result = result + ZapInfo(logger, l) + } +}