Skip to content

Commit

Permalink
添加主键ID
Browse files Browse the repository at this point in the history
  • Loading branch information
steden committed Dec 31, 2023
1 parent 8b682d3 commit 8323b70
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion flog/logData.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"github.com/farseer-go/fs/core"
"github.com/farseer-go/fs/core/eumLogLevel"
"github.com/farseer-go/fs/dateTime"
"github.com/farseer-go/fs/snowflake"
"github.com/farseer-go/fs/trace"
"regexp"
)
Expand All @@ -24,14 +25,15 @@ type LogData struct {
AppId int64 // 应用ID
AppName string // 应用名称
AppIp string // 应用IP
Id int64 // 主键ID
}

func newLogData(logLevel eumLogLevel.Enum, content string, component string) *LogData {
var traceId int64
if t := trace.CurTraceContext.Get(); t != nil {
traceId = t.GetTraceId()
}
return &LogData{Content: content, CreateAt: dateTime.Now(), LogLevel: logLevel, Component: component, newLine: true, TraceId: traceId, AppId: core.AppId, AppName: core.AppName, AppIp: core.AppIp}
return &LogData{Content: content, CreateAt: dateTime.Now(), LogLevel: logLevel, Component: component, newLine: true, TraceId: traceId, AppId: core.AppId, AppName: core.AppName, AppIp: core.AppIp, Id: snowflake.GenerateId()}
}

//// 清除颜色
Expand Down

0 comments on commit 8323b70

Please sign in to comment.