Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move logger into context #208

Merged
merged 1 commit into from Apr 18, 2022
Merged

Move logger into context #208

merged 1 commit into from Apr 18, 2022

Commits on Apr 18, 2022

  1. Move logger into context

    The logger was previously available on the Config object as well as from
    the context via `logr.FromContext(ctx)`. While they are the same root
    logger, each has a different set of names and values applied to each log
    line.
    
    Loading the logger from the context is the preferred approach moving
    forward. The logger on the Config is still available, but is deprecated
    and will be removed in a future release. The first use of the `c.Log`
    methods will trigger an error printed to the log.
    
    Each reconciler in the call chain can enrich the logger as it is passed
    deeper in the reconciler hierarchy. Many reconciler have a new `Name`
    field that is appended to the logger's name for all log statements under
    it. `ParentReconciler`, `ChildReconciler` and `CastParent` provide
    default names based on the type they are reconciling. Unique names are
    recommended, but are not required, since they only appear in logs and do
    not affect the runtime behavior.
    
    Signed-off-by: Scott Andrews <andrewssc@vmware.com>
    scothis committed Apr 18, 2022
    Copy the full SHA
    7c7dad4 View commit details
    Browse the repository at this point in the history