package gosafe import ( "context" "runtime/debug" "gitea.micah.com/micah/standard/pkg/log" ) // Recovery . func Recovery(ctx context.Context) { e := recover() if e == nil { return } if ctx == nil { ctx = context.Background() } log.Errorf("catch panic err=%v\nstacktrace=%s", e, debug.Stack()) }