recover 之后打印panic的调用栈

recover 之后打印panic的调用栈

recover 之后打印 panic 的调用栈

打印 recover 的 panic 调用栈

func main() {
	defer func() {
		if rec := recover(); rec != nil {
			buf := make([]byte, 1<<16)
			runtime.Stack(buf, true)
			grpclog.Errorln("recover success")
			grpclog.Errorf("recover ", string(buf))
		}
	}()
	panic("test err")
}