diff --git a/controllers/topology/internal/log/log.go b/controllers/topology/internal/log/log.go index b655084e2d13..ad3e998f8dcd 100644 --- a/controllers/topology/internal/log/log.go +++ b/controllers/topology/internal/log/log.go @@ -115,6 +115,12 @@ func (l *topologyReconcileLogger) V(level int) Logger { // Infof logs to the INFO log. // Arguments are handled in the manner of fmt.Printf. func (l *topologyReconcileLogger) Infof(msg string, a ...interface{}) { + // If the logger implements CallDepthLogger, let's use WithCallDepth + // so the logger prints the log line of the caller not of the current line. + if logger, ok := l.Logger.(logr.CallDepthLogger); ok { + logger.WithCallDepth(1).Info(fmt.Sprintf(msg, a...)) + return + } l.Logger.Info(fmt.Sprintf(msg, a...)) }