-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The use of `logr.Logger.WithValues` in the `pkg/runtime/log.AdoptResource` function was not actually overwriting previously set key/value pairs -- for instance, for the resource's kind, generation or namespace. Instead, these structured log record fields were simply being appended to the end of the `[]interface{}` that `logr.Logger` uses to track log record fields. See https://pkg.go.dev/github.com/go-logr/logr#readme-why-key-value-pairs-and-not-a-map for information on why a `[]interface{}` is used instead of a `map[string]interface{}`, which would have avoided this bug/problem. This patch removes the use of `logr.Logger.WithValues` in the `ResourceLogger.Debug`, `ResourceLogger.Enter|Exit` and ResourceLogger.Info` methods and replaces with direct passing of the core resource fields into the `logr.Logger.Info` method. Fixes Issue aws-controllers-k8s/runtime#938 By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
- Loading branch information
Showing
1 changed file
with
57 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters