日志参数转字符串

This commit is contained in:
yuguojian
2025-07-15 15:26:59 +08:00
parent 093b34f32f
commit 7f0c64fd8a
2 changed files with 4 additions and 83 deletions

View File

@@ -36,8 +36,8 @@ const (
)
type Operator struct {
ID int // 系统ID设置0
OperatorType OperatorType
ID int // 系统ID设置0
OperatorType OperatorType `json:"operator_type"`
}
type LogInfo struct {
@@ -91,7 +91,7 @@ func ZapFatal(logger *zap.Logger, log *LogInfo) {
func HandleLog(log *LogInfo) {
// 处理 Param
//log.Param = processValue(log.Param)
log.Param = processValue(log.Param)
// 处理 Result
log.Result = processValue(log.Result)
}
@@ -150,9 +150,5 @@ func processValue(value interface{}) interface{} {
if value == nil {
return ""
}
if _, ok := value.(error); ok {
return fmt.Sprintf("%+v", value)
} else {
return value
}
return fmt.Sprintf("%+v", value)
}