From 6b413c8351abd92f8f9953bb9b41fc9e2262b99c Mon Sep 17 00:00:00 2001 From: Brad Town Date: Thu, 9 May 2024 12:44:18 -0700 Subject: [PATCH] xds: Surround two `Infof` calls that use `pretty.ToJSON` with `V(2)` checks (#7216) --- xds/internal/balancer/clusterimpl/clusterimpl.go | 4 +++- xds/internal/balancer/clusterresolver/clusterresolver.go | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/xds/internal/balancer/clusterimpl/clusterimpl.go b/xds/internal/balancer/clusterimpl/clusterimpl.go index de5a0fdc95bb..164f3099d280 100644 --- a/xds/internal/balancer/clusterimpl/clusterimpl.go +++ b/xds/internal/balancer/clusterimpl/clusterimpl.go @@ -211,7 +211,9 @@ func (b *clusterImplBalancer) UpdateClientConnState(s balancer.ClientConnState) return nil } - b.logger.Infof("Received update from resolver, balancer config: %+v", pretty.ToJSON(s.BalancerConfig)) + if b.logger.V(2) { + b.logger.Infof("Received update from resolver, balancer config: %s", pretty.ToJSON(s.BalancerConfig)) + } newConfig, ok := s.BalancerConfig.(*LBConfig) if !ok { return fmt.Errorf("unexpected balancer config with type: %T", s.BalancerConfig) diff --git a/xds/internal/balancer/clusterresolver/clusterresolver.go b/xds/internal/balancer/clusterresolver/clusterresolver.go index eccd81af173d..83ead92a4a69 100644 --- a/xds/internal/balancer/clusterresolver/clusterresolver.go +++ b/xds/internal/balancer/clusterresolver/clusterresolver.go @@ -242,7 +242,9 @@ func (b *clusterResolverBalancer) updateChildConfig() { b.logger.Warningf("Failed to parse child policy config. This should never happen because the config was generated: %v", err) return } - b.logger.Infof("Built child policy config: %v", pretty.ToJSON(childCfg)) + if b.logger.V(2) { + b.logger.Infof("Built child policy config: %s", pretty.ToJSON(childCfg)) + } endpoints := make([]resolver.Endpoint, len(addrs)) for i, a := range addrs {