grpc: move gRPC INFO logs to be emitted as TRACE logs from Consul (#10395)

Fixes #10183
This commit is contained in:
R.B. Boyer 2021-06-14 15:13:58 -05:00 committed by GitHub
parent f19b1f0058
commit b050232abb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 4 deletions

3
.changelog/10395.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:improvement
grpc: move gRPC INFO logs to be emitted as TRACE logs from Consul
```

View File

@ -28,7 +28,8 @@ func NewGRPCLogger(logLevel string, logger hclog.Logger) *GRPCLogger {
// Info implements grpclog.LoggerV2 // Info implements grpclog.LoggerV2
func (g *GRPCLogger) Info(args ...interface{}) { 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 // Infoln implements grpclog.LoggerV2

View File

@ -36,9 +36,9 @@ func TestGRPCLogger(t *testing.T) {
grpclog.Errorf("Errorf: %d", 1) grpclog.Errorf("Errorf: %d", 1)
// Fatal tests are hard... assume they are good! // Fatal tests are hard... assume they are good!
expect := `timeformat [INFO] Info, expect := `timeformat [TRACE] Info,
timeformat [INFO] Infoln timeformat [TRACE] Infoln
timeformat [INFO] Infof: 1 timeformat [TRACE] Infof: 1
timeformat [WARN] Warning, timeformat [WARN] Warning,
timeformat [WARN] Warningln timeformat [WARN] Warningln
timeformat [WARN] Warningf: 1 timeformat [WARN] Warningf: 1