@@ -618,6 +618,7 @@ func callers(at, until int, sep1, sep2 string) (pcs []uintptr, files []string, s
618618 } else {
619619 // ex: fn = "github.com/celzero/firestack/intra/dnsx.ChooseHealthyProxyHostPort"
620620 fn = shortfile (fn )
621+ fn = shortfn (fn )
621622 }
622623
623624 file += sep2 + fn
@@ -649,6 +650,17 @@ func shortfile(file string) string {
649650 return file
650651}
651652
653+ // shortfn strips the package and receiver type from a fully-qualified
654+ // function name, keeping only the function name itself.
655+ // ex: "ipn.(*proxifier).RegisterWin" >> "RegisterWin"
656+ // ex: "rpn.makeWsWg" >> "makeWsWg"
657+ func shortfn (fn string ) string {
658+ if i := strings .LastIndexByte (fn , '.' ); i >= 0 {
659+ fn = fn [i + 1 :]
660+ }
661+ return fn
662+ }
663+
652664func (l * simpleLogger ) writelog (lvl LogLevel , at int , msg string , args ... any ) {
653665 ll := l .level <= lvl
654666 cc := l .clevel <= lvl
@@ -675,6 +687,14 @@ func (l *simpleLogger) writelog(lvl LogLevel, at int, msg string, args ...any) {
675687 }
676688 }
677689
690+ // ex: go_backendmain.go:6895@_cgoexp_d123334b966f_proxybackend_Rpn_RegisterWin
691+ // > go_backendmain.go:7120@main.proxybackend_Rpn_RegisterWin
692+ // > proxies.go:1271@ipn.(*proxifier).RegisterWin
693+ // > proxies.go:1296@ipn.(*proxifier).registerWin
694+ // > yegor.go:1868@rpn.(*BaseClient).MakeWsWgFrom
695+ // > yegor.go:1790@rpn.(*BaseClient).MakeWsWg
696+ // > yegor.go:1809@rpn.makeWsWg
697+ // > yegor.go:1602@rpn.genWgConfs
678698 if ll || cc {
679699 _ , x , _ := callers (at + nextframe , 9 , ":" , "@" )
680700 switch lvl {
0 commit comments