From 3a96135df81c52b65e94bd67ae4f5ca08f80396b Mon Sep 17 00:00:00 2001 From: wangxu Date: Tue, 25 Aug 2020 17:11:02 +0800 Subject: [PATCH] add log grpc handler err (#1973) Co-authored-by: wangxu --- server/grpc/grpc.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/grpc/grpc.go b/server/grpc/grpc.go index 1de8a83e..11724ca4 100644 --- a/server/grpc/grpc.go +++ b/server/grpc/grpc.go @@ -194,6 +194,10 @@ func (g *grpcServer) handler(srv interface{}, stream grpc.ServerStream) (err err logger.Error(string(debug.Stack())) } err = errors.InternalServerError(g.opts.Name, "panic recovered: %v", r) + } else if err != nil { + if logger.V(logger.InfoLevel, logger.DefaultLogger) { + logger.Errorf("grpc handler got error: %s", err) + } } }()