2020-03-24 13:15:01 +00:00
|
|
|
package tracing
|
|
|
|
|
|
|
|
import (
|
|
|
|
"runtime"
|
|
|
|
|
2022-04-26 23:01:45 +00:00
|
|
|
"github.com/zitadel/logging"
|
2020-03-24 13:15:01 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func GetCaller() string {
|
|
|
|
fpcs := make([]uintptr, 1)
|
|
|
|
n := runtime.Callers(3, fpcs)
|
|
|
|
if n == 0 {
|
2020-03-30 05:23:43 +00:00
|
|
|
logging.Log("TRACE-rWjfC").Debug("no caller")
|
|
|
|
return ""
|
2020-03-24 13:15:01 +00:00
|
|
|
}
|
|
|
|
caller := runtime.FuncForPC(fpcs[0] - 1)
|
|
|
|
if caller == nil {
|
2020-03-30 05:23:43 +00:00
|
|
|
logging.Log("TRACE-25POw").Debug("caller was nil")
|
|
|
|
return ""
|
2020-03-24 13:15:01 +00:00
|
|
|
}
|
|
|
|
return caller.Name()
|
|
|
|
}
|