Skip to content

KubeAwareEncoder doesn't work with logger.With(..) but does with logger.Info(, ...) #1443

@nmiculinic

Description

@nmiculinic

In this example obj is runtime.Object:

// for some reason logger.With(...) doesn't work the best
logger.With(zap.Reflect("obj", obj)).Info("AAA")
// with kubeAware encoder, but this does
logger.Debug("BBB", zap.Reflect("obj", obj))
// it seems like zap doesn't pass .With(fields) fields to the EncodeEntry
// of the kubeAware encoder

Which seems super weird and error-prone. The logger is typical *zap.Logger.

controller-runtime version v0.8.0

(I'll upgrade, but this code hasn't changed much since then)

Metadata

Metadata

Assignees

No one assigned

    Labels

    lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions