github.com/TrueBlocks/trueblocks-core/src/apps/chifra@v0.0.0-20241022031540-b362680128f7/pkg/utils/trace.go (about) 1 package utils 2 3 import ( 4 "log" 5 "path/filepath" 6 "runtime" 7 "strings" 8 ) 9 10 func Trace() { 11 pc := make([]uintptr, 10) // at least 1 entry needed 12 runtime.Callers(2, pc) 13 f := runtime.FuncForPC(pc[0]) 14 file, line := f.FileLine(pc[0]) 15 _, fn := filepath.Split(file) 16 n := strings.Replace(f.Name(), "github.com/TrueBlocks/trueblocks-core/src/apps/chifra", ".", 1) 17 log.Printf("%s:%d %s\n", fn, line, n) 18 }