Skip to content

Commit

Permalink
xds/internal: Replace calls to Debugf with V(2) checks and Infof (
Browse files Browse the repository at this point in the history
  • Loading branch information
townba authored May 2, 2024
1 parent 796c615 commit c7c8aa8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion xds/internal/balancer/priority/balancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion xds/internal/xdsclient/authority.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) })
}
Expand Down
4 changes: 3 additions & 1 deletion xds/internal/xdsclient/bootstrap/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit c7c8aa8

Please sign in to comment.