Files
log/entry/caller.go
andrey 1637fb5119
Some checks failed
Go Action / lint (push) Has been cancelled
Go Action / lint (pull_request) Has been cancelled
update lint
2025-12-23 20:59:06 +03:00

24 lines
316 B
Go

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)
}