改为github的包

This commit is contained in:
Yun
2024-04-18 12:02:44 +08:00
parent b58849b5b2
commit 4f1a91faad
3 changed files with 10 additions and 4 deletions
+7 -1
View File
@@ -6,6 +6,7 @@ import (
"fmt"
"path/filepath"
"runtime"
"runtime/debug"
"strings"
"time"
)
@@ -40,11 +41,15 @@ func (l *Logger) logger(ctx context.Context, event string, v ...any) {
Content: string(by),
TraceId: traceId,
}
if event == "error" {
fd.Stack = string(debug.Stack())
}
fdb, _ := json.Marshal(fd)
ff := []byte("\n[" + event + "]")
fdb = append(ff, fdb...)
l.write(event, fdb)
@@ -62,4 +67,5 @@ type FormatData struct {
Gid string `json:"gid,omitempty"`
Content string `json:"content,omitempty"`
TraceId string `json:"traceId,omitempty"`
Stack string `json:"stack,omitempty"`
}