From 33e119864e13fb4f621cb2e99ba8c5b29792a3d1 Mon Sep 17 00:00:00 2001 From: yuguojian <18126816215> Date: Mon, 14 Jul 2025 15:26:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E5=BF=97=E5=8F=82=E6=95=B0=E8=BD=AC?= =?UTF-8?q?=E5=AD=97=E7=AC=A6=E4=B8=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- log/log.go | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/log/log.go b/log/log.go index 9408a08..ea00e11 100644 --- a/log/log.go +++ b/log/log.go @@ -3,7 +3,6 @@ package log import ( "context" "fmt" - "github.com/dromara/carbon/v2" "github.com/gogf/gf/v2/frame/g" "go.uber.org/zap" ) @@ -48,9 +47,6 @@ type LogInfo struct { Title string `json:"title"` // 必填,标题,做什么事情 Param interface{} `json:"param,omitempty"` // 参数,请求参数,传指针 Result interface{} `json:"result,omitempty"` // 结果,返回值,传指针,如果是报错,传err - ErrStr string `json:"err_str,omitempty"` // 错误信息,不用传入,自动记录 - At string `json:"at"` // 记录时间,不用传入,自动记录 - Timestamp int64 `json:"timestamp"` // 时间戳,不用传入,自动记录 } type param struct { @@ -94,17 +90,10 @@ func ZapFatal(logger *zap.Logger, log *LogInfo) { } func HandleLog(log *LogInfo) { - log.At = carbon.Now().ToDateTimeString() - log.Timestamp = carbon.Now().Timestamp() // 处理 Param log.Param = processValue(log.Param) // 处理 Result - if _, ok := log.Result.(error); ok { - log.ErrStr = fmt.Sprintf("%+v", log.Result) - log.Result = struct{}{} - } else { - log.Result = processValue(log.Result) - } + log.Result = processValue(log.Result) } func GFInfo(ctx context.Context, log *LogInfo) {