From b050232abb3b250dd7f002af1c1ee2b56d2abfcc Mon Sep 17 00:00:00 2001 From: "R.B. Boyer" <4903+rboyer@users.noreply.github.com> Date: Mon, 14 Jun 2021 15:13:58 -0500 Subject: [PATCH] grpc: move gRPC INFO logs to be emitted as TRACE logs from Consul (#10395) Fixes #10183 --- .changelog/10395.txt | 3 +++ logging/grpc.go | 3 ++- logging/grpc_test.go | 6 +++--- 3 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 .changelog/10395.txt diff --git a/.changelog/10395.txt b/.changelog/10395.txt new file mode 100644 index 000000000..7750f2fda --- /dev/null +++ b/.changelog/10395.txt @@ -0,0 +1,3 @@ +```release-note:improvement +grpc: move gRPC INFO logs to be emitted as TRACE logs from Consul +``` diff --git a/logging/grpc.go b/logging/grpc.go index 53188bd37..6e960a0c7 100644 --- a/logging/grpc.go +++ b/logging/grpc.go @@ -28,7 +28,8 @@ func NewGRPCLogger(logLevel string, logger hclog.Logger) *GRPCLogger { // Info implements grpclog.LoggerV2 func (g *GRPCLogger) Info(args ...interface{}) { - g.logger.Info(fmt.Sprint(args...)) + // gRPC's INFO level is more akin to Consul's TRACE level + g.logger.Trace(fmt.Sprint(args...)) } // Infoln implements grpclog.LoggerV2 diff --git a/logging/grpc_test.go b/logging/grpc_test.go index bd19f958e..de803ce4e 100644 --- a/logging/grpc_test.go +++ b/logging/grpc_test.go @@ -36,9 +36,9 @@ func TestGRPCLogger(t *testing.T) { grpclog.Errorf("Errorf: %d", 1) // Fatal tests are hard... assume they are good! - expect := `timeformat [INFO] Info, -timeformat [INFO] Infoln -timeformat [INFO] Infof: 1 + expect := `timeformat [TRACE] Info, +timeformat [TRACE] Infoln +timeformat [TRACE] Infof: 1 timeformat [WARN] Warning, timeformat [WARN] Warningln timeformat [WARN] Warningf: 1