改为github的包
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"runtime/debug"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
@@ -40,12 +41,16 @@ 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)
|
||||
|
||||
if l.option.errorToInfo && event == "error" {
|
||||
@@ -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"`
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module code.yun.ink/pkg/loggerx
|
||||
module github.com/yuninks/loggerx
|
||||
|
||||
go 1.19
|
||||
go 1.20
|
||||
|
||||
require github.com/gin-gonic/gin v1.9.1
|
||||
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"code.yun.ink/pkg/loggerx"
|
||||
"github.com/yuninks/loggerx"
|
||||
)
|
||||
|
||||
// func TestMain(m *testing.M) {
|
||||
|
||||
Reference in New Issue
Block a user