mirror of
https://github.com/coder/coder.git
synced 2025-07-03 16:13:58 +00:00
20 lines
273 B
Go
20 lines
273 B
Go
package tracing
|
|
|
|
import (
|
|
"runtime"
|
|
"strings"
|
|
)
|
|
|
|
func FuncName() string {
|
|
fnpc, _, _, ok := runtime.Caller(1)
|
|
if !ok {
|
|
return ""
|
|
}
|
|
fn := runtime.FuncForPC(fnpc)
|
|
name := fn.Name()
|
|
if i := strings.LastIndex(name, "/"); i > 0 {
|
|
name = name[i+1:]
|
|
}
|
|
return name
|
|
}
|