内容用interface

This commit is contained in:
Yun
2024-06-27 21:06:47 +08:00
parent 968e381e6d
commit 7eb883bf67
+9 -9
View File
@@ -24,7 +24,7 @@ func (l *Logger) logger(ctx context.Context, event string, v ...any) {
funcName = filepath.Ext(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")
@@ -37,7 +37,7 @@ func (l *Logger) logger(ctx context.Context, event string, v ...any) {
File: file + ":" + fmt.Sprintf("%d", line),
Func: funcName,
Gid: getGID(),
Content: string(by),
Content: v,
TraceId: traceId,
}
@@ -60,11 +60,11 @@ func (l *Logger) logger(ctx context.Context, event string, v ...any) {
}
type FormatData struct {
Time string `json:"time,omitempty"`
File string `json:"file,omitempty"`
Func string `json:"func,omitempty"`
Gid string `json:"gid,omitempty"`
Content string `json:"content,omitempty"`
TraceId string `json:"traceId,omitempty"`
Stack string `json:"stack,omitempty"`
Time string `json:"time,omitempty"`
File string `json:"file,omitempty"`
Func string `json:"func,omitempty"`
Gid string `json:"gid,omitempty"`
Content interface{} `json:"content,omitempty"`
TraceId string `json:"traceId,omitempty"`
Stack string `json:"stack,omitempty"`
}