mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
get func name
This commit is contained in:
parent
c092c0e72d
commit
0138b7fc12
@ -36,6 +36,12 @@ func GetSelfFuncName() string {
|
||||
pc, _, _, _ := runtime.Caller(1)
|
||||
return cleanUpFuncName(runtime.FuncForPC(pc).Name())
|
||||
}
|
||||
|
||||
func GetFuncName(skip int) string {
|
||||
pc, _, _, _ := runtime.Caller(skip + 1)
|
||||
return cleanUpFuncName(runtime.FuncForPC(pc).Name())
|
||||
}
|
||||
|
||||
func cleanUpFuncName(funcName string) string {
|
||||
end := strings.LastIndex(funcName, ".")
|
||||
if end == -1 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user