增加日志方法
This commit is contained in:
parent
d311a8368a
commit
3b335785a4
20
log/log.go
20
log/log.go
@ -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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user