v0.0.188 exerr MVP
This commit is contained in:
14
exerr/stacktrace.go
Normal file
14
exerr/stacktrace.go
Normal file
@@ -0,0 +1,14 @@
|
||||
package exerr
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"runtime"
|
||||
)
|
||||
|
||||
func callername(skip int) string {
|
||||
pc := make([]uintptr, 15)
|
||||
n := runtime.Callers(skip+2, pc)
|
||||
frames := runtime.CallersFrames(pc[:n])
|
||||
frame, _ := frames.Next()
|
||||
return fmt.Sprintf("%s:%d %s", frame.File, frame.Line, frame.Function)
|
||||
}
|
Reference in New Issue
Block a user