fix: persist logs without caller path
Deploy olons-admin production / deploy (push) Successful in 6m0s

This commit is contained in:
Your Name
2026-10-19 00:17:48 +08:00
parent e3898b618c
commit 91fc53b20c
2 changed files with 32 additions and 1 deletions
+9 -1
View File
@@ -111,7 +111,7 @@ func LoggingServeLogHandler(ctx context.Context, in *glog.HandlerInput) {
data.LevelFormat = in.LevelFormat
data.Content = in.Content
data.Stack = gjson.New(charset.ParseStack(in.Stack))
data.Line = strings.TrimRight(in.CallerPath, ":")
data.Line = normalizeServeLogLine(in.CallerPath)
data.TriggerNs = in.Time.UnixNano()
data.Status = consts.StatusEnabled
@@ -135,6 +135,14 @@ func LoggingServeLogHandler(ctx context.Context, in *glog.HandlerInput) {
}
}
func normalizeServeLogLine(callerPath string) string {
line := strings.TrimRight(callerPath, ":")
if line == "" {
return "unknown"
}
return line
}
// InitTrace 初始化链路追踪
func InitTrace(ctx context.Context) {
if !g.Cfg().MustGet(ctx, "jaeger.switch").Bool() {