feat: align GetDefaultName with service SOP (by AI)
This commit is contained in:
parent
6dfb33c459
commit
9459a98224
@ -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 {
|
||||
|
||||
@ -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 == "" {
|
||||
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
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user