diff --git a/logger.go b/logger.go index 7502a14..9b20b17 100644 --- a/logger.go +++ b/logger.go @@ -48,7 +48,7 @@ func NewLogger(conf Config) *Logger { logger := Logger{ truncations: cast.Split(conf.Truncations, ","), - traceId: id.MakeID(10), + traceId: id.Get10Bytes14MPerSecond(), } if len(conf.Sensitive) > 0 { diff --git a/utility.go b/utility.go index c7e119a..9d25986 100644 --- a/utility.go +++ b/utility.go @@ -194,17 +194,14 @@ func getCallStacks(truncations []string) []string { // GetDefaultName 获取默认应用名称 func GetDefaultName() string { - name := os.Getenv("DISCOVER_APP") - if name == "" { - name = os.Getenv("discover_app") - } - if name == "" { - if info, ok := debug.ReadBuildInfo(); ok && info.Path != "" && info.Path != "command-line-arguments" { - name = path.Base(info.Path) - } + name := "" + if info, ok := debug.ReadBuildInfo(); ok && info.Path != "" && info.Path != "command-line-arguments" { + name = path.Base(info.Path) } if name == "" { name = path.Base(os.Args[0]) } + // 处理 Windows 下的 .exe 后缀 + name = strings.TrimSuffix(name, ".exe") return name }