内容用interface

This commit is contained in:
Yun
2024-06-27 21:06:47 +08:00
parent 968e381e6d
commit 7eb883bf67
+3 -3
View File
@@ -24,7 +24,7 @@ func (l *Logger) logger(ctx context.Context, event string, v ...any) {
funcName = filepath.Ext(funcName) funcName = filepath.Ext(funcName)
funcName = strings.TrimPrefix(funcName, ".") funcName = strings.TrimPrefix(funcName, ".")
by, _ := json.Marshal(v) // by, _ := json.Marshal(v)
nowTime := time.Now().In(l.option.timeZone).Format("2006-01-02 15:04:05.000000") nowTime := time.Now().In(l.option.timeZone).Format("2006-01-02 15:04:05.000000")
@@ -37,7 +37,7 @@ func (l *Logger) logger(ctx context.Context, event string, v ...any) {
File: file + ":" + fmt.Sprintf("%d", line), File: file + ":" + fmt.Sprintf("%d", line),
Func: funcName, Func: funcName,
Gid: getGID(), Gid: getGID(),
Content: string(by), Content: v,
TraceId: traceId, TraceId: traceId,
} }
@@ -64,7 +64,7 @@ type FormatData struct {
File string `json:"file,omitempty"` File string `json:"file,omitempty"`
Func string `json:"func,omitempty"` Func string `json:"func,omitempty"`
Gid string `json:"gid,omitempty"` Gid string `json:"gid,omitempty"`
Content string `json:"content,omitempty"` Content interface{} `json:"content,omitempty"`
TraceId string `json:"traceId,omitempty"` TraceId string `json:"traceId,omitempty"`
Stack string `json:"stack,omitempty"` Stack string `json:"stack,omitempty"`
} }