Skip to content

Commit

Permalink
Merge pull request #5584 from k8s-infra-cherrypick-robot/cherry-pick-…
Browse files Browse the repository at this point in the history
…5568-to-release-1.0

🌱 topologyReconcileLogger: print the correct log lines
  • Loading branch information
k8s-ci-robot authored Nov 4, 2021
2 parents 82a9028 + 423e0dc commit cd72243
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions controllers/topology/internal/log/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -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...))
}

Expand Down

0 comments on commit cd72243

Please sign in to comment.