You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
315 B

package entry
import (
"path/filepath"
"runtime"
"strconv"
)
func Caller(depth int, full bool) string {
const offset = 3
_, file, line, has := runtime.Caller(depth + offset)
if !has {
file, line = "???", 0
}
if !full && has {
file = filepath.Base(file)
}
return file + ":" + strconv.Itoa(line)
}