From a186c70446ba2a17d967e86dd8e0fcb76761aadf 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 --- grpc.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/grpc.go b/grpc.go index 1de8a83..11724ca 100644 --- a/grpc.go +++ b/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) + } } }()