增加日志方法

This commit is contained in:
yuguojian 2025-05-14 09:49:39 +08:00
parent d311a8368a
commit 3b335785a4

View File

@ -114,3 +114,23 @@ func GFFatal(ctx context.Context, log *LogInfo) {
handleLog(log) handleLog(log)
g.Log().Fatal(ctx, 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)
}
}