Skip to content

Commit

Permalink
AppId、AppName、AppIp 迁移到core包
Browse files Browse the repository at this point in the history
  • Loading branch information
steden committed Dec 31, 2023
1 parent 606a9e3 commit 8b682d3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 0 additions & 3 deletions flog/fopsProvider.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ func (r *fopsLoggerPersistent) IsEnabled(logLevel eumLogLevel.Enum) bool {
func (r *fopsLoggerPersistent) Log(LogLevel eumLogLevel.Enum, log *LogData, exception error) {
if LogLevel != eumLogLevel.NoneLevel {
log.Content = mustCompile.ReplaceAllString(log.Content, "")
log.AppId = core.AppId
log.AppIp = core.AppIp
log.AppName = core.AppName
r.queue <- log
}
}
Expand Down
8 changes: 7 additions & 1 deletion flog/logData.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package flog

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/trace"
"regexp"
)

Expand All @@ -25,7 +27,11 @@ type LogData struct {
}

func newLogData(logLevel eumLogLevel.Enum, content string, component string) *LogData {
return &LogData{Content: content, CreateAt: dateTime.Now(), LogLevel: logLevel, Component: component, newLine: true}
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}
}

//// 清除颜色
Expand Down

0 comments on commit 8b682d3

Please sign in to comment.