Skip to content

Commit d5a2534

Browse files
committed
log: rmv fully-qualified func names
1 parent 3a48afc commit d5a2534

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

intra/log/logger.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ func caller2(at int, sep1, sep2 string) (pc uintptr, who string) {
574574
}
575575

576576
// go.dev/play/p/h9Woqcp0Xz0
577-
func callers(at, until int, sep1 string) (pcs []uintptr, files []string, skipped int) {
577+
func callers(at, until int, sep1, sep2 string) (pcs []uintptr, files []string, skipped int) {
578578
if until <= 0 {
579579
return []uintptr{0}, []string{fileunknown}, 0
580580
} else if until == 1 {
@@ -599,11 +599,14 @@ func callers(at, until int, sep1 string) (pcs []uintptr, files []string, skipped
599599
fn := frame.Function
600600
if len(fn) <= 0 {
601601
fn = callerunknown
602+
} else {
603+
// ex: github.com/celzero/firestack/intra/dnsx.ChooseHealthyProxyHostPort
604+
fn = shortfile(fn)
602605
}
603606
if len(file) <= 0 { // more is false when file is empty
604607
file = fileunknown
605608
} else {
606-
file = shortfile(file) + sep1 + fn + sep1 + fmt.Sprint(line)
609+
file = shortfile(file) + sep1 + fmt.Sprint(line) + sep2 + fn
607610
}
608611
pcs = append(pcs, pc)
609612
files = append(files, file)
@@ -660,7 +663,7 @@ func (l *simpleLogger) writelog(lvl LogLevel, at int, msg string, args ...any) {
660663
}
661664

662665
if ll || cc {
663-
_, x, _ := callers(at+nextframe, 7, ":")
666+
_, x, _ := callers(at+nextframe, 7, ":", "@")
664667
switch lvl {
665668
case USR, STACKTRACE, NONE: // no-op
666669
case VVERBOSE:

0 commit comments

Comments
 (0)