xds/internal: Replace calls to `Debugf` with `V(2)` checks and `Infof` (#7180)

This commit is contained in:
Brad Town 2024-05-02 16:45:39 -07:00 committed by GitHub
parent 796c61536a
commit c7c8aa8f53
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 3 deletions

View File

@ -115,7 +115,9 @@ type priorityBalancer struct {
}
func (b *priorityBalancer) UpdateClientConnState(s balancer.ClientConnState) error {
b.logger.Debugf("Received an update with balancer config: %+v", pretty.ToJSON(s.BalancerConfig))
if b.logger.V(2) {
b.logger.Infof("Received an update with balancer config: %+v", pretty.ToJSON(s.BalancerConfig))
}
newConfig, ok := s.BalancerConfig.(*LBConfig)
if !ok {
return fmt.Errorf("unexpected balancer config with type: %T", s.BalancerConfig)

View File

@ -482,7 +482,9 @@ func (a *authority) watchResource(rType xdsresource.Type, resourceName string, w
// If we have a cached copy of the resource, notify the new watcher.
if state.cache != nil {
a.logger.Debugf("Resource type %q with resource name %q found in cache: %s", rType.TypeName(), resourceName, state.cache.ToJSON())
if a.logger.V(2) {
a.logger.Infof("Resource type %q with resource name %q found in cache: %s", rType.TypeName(), resourceName, state.cache.ToJSON())
}
resource := state.cache
a.serializer.Schedule(func(context.Context) { watcher.OnUpdate(resource) })
}

View File

@ -568,6 +568,8 @@ func newConfigFromContents(data []byte) (*Config, error) {
node.ClientFeatures = append(node.ClientFeatures, clientFeatureNoOverprovisioning, clientFeatureResourceWrapper)
config.NodeProto = node
logger.Debugf("Bootstrap config for creating xds-client: %v", pretty.ToJSON(config))
if logger.V(2) {
logger.Infof("Bootstrap config for creating xds-client: %v", pretty.ToJSON(config))
}
return config, nil
}