Skip to content

Commit

Permalink
Pass logger to machine pool scope to get verbosity right, fix copying…
Browse files Browse the repository at this point in the history
… logger in `With...` methods
  • Loading branch information
AndiDog committed Nov 6, 2023
1 parent 07e91d2 commit 70ada99
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions exp/controllers/awsmachinepool_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ func (r *AWSMachinePoolReconciler) Reconcile(ctx context.Context, req ctrl.Reque
// Create the machine pool scope
machinePoolScope, err := scope.NewMachinePoolScope(scope.MachinePoolScopeParams{
Client: r.Client,
Logger: log,
Cluster: cluster,
MachinePool: machinePool,
InfraCluster: infraCluster,
Expand Down
12 changes: 8 additions & 4 deletions pkg/logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,15 @@ func (c *Logger) GetLogger() logr.Logger {
}

func (c *Logger) WithValues(keysAndValues ...any) *Logger {
c.logger = c.logger.WithValues(keysAndValues...)
return c
return &Logger{
callStackHelper: c.callStackHelper,
logger: c.logger.WithValues(keysAndValues...),
}
}

func (c *Logger) WithName(name string) *Logger {
c.logger = c.logger.WithName(name)
return c
return &Logger{
callStackHelper: c.callStackHelper,
logger: c.logger.WithName(name),
}
}

0 comments on commit 70ada99

Please sign in to comment.