mirror of
https://github.com/AdguardTeam/AdGuardDNS.git
synced 2025-02-20 11:23:36 +08:00
20 lines
365 B
Go
20 lines
365 B
Go
package errcoll
|
|
|
|
import (
|
|
"fmt"
|
|
"runtime"
|
|
)
|
|
|
|
// Common Functionality
|
|
|
|
// caller returns the caller position using the appropriate depth.
|
|
func caller(depth int) (callerPos string) {
|
|
callerPos = "<position unknown>"
|
|
_, callerFile, callerLine, ok := runtime.Caller(depth)
|
|
if ok {
|
|
callerPos = fmt.Sprintf("%s:%d", callerFile, callerLine)
|
|
}
|
|
|
|
return callerPos
|
|
}
|