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

slog context support #237

Merged
merged 2 commits into from
Dec 1, 2023
Merged

slog context support #237

merged 2 commits into from
Dec 1, 2023

Commits on Nov 30, 2023

  1. move slogr into main package

    This is necessary to give the context handling functions access to the slogr
    functionality. Functions get renamed to match names in the main package
    where needed.
    
    The slogr package is now deprecated, but continues to be supported as part of
    the logr v1 API by keeping all exported items as wrappers or aliases for the
    main package.
    pohly committed Nov 30, 2023
    Configuration menu
    Copy the full SHA
    5e3484c View commit details
    Browse the repository at this point in the history
  2. support a slog.Logger pointer in a context

    Conversion is done on demand. A program which uses either slog or logr for
    logging remains as efficient as before. What is less efficient is storing a
    logger of one type and then retrieving it as the other.
    
    Ideally, reusable packages should avoid using a slog.Logger and prefer
    logr.Logger instead when retrieving a logger from a context. There is a
    significant amount of packages which already work that way (Kubernetes and
    related packages), while storing and retrieving a logr.Logger is new and not
    done anywhere yet. Emulating existing behavior ensures better performance.
    pohly committed Nov 30, 2023
    Configuration menu
    Copy the full SHA
    f1edf4f View commit details
    Browse the repository at this point in the history