You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
0 commit comments