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 support: fix WithGroup + WithValues combination #243

Merged
merged 2 commits into from
Dec 4, 2023

Conversation

pohly
Copy link
Contributor

@pohly pohly commented Dec 4, 2023

The invalid initialization of the sink field in the WithGroup method was found by @thockin during code reading.

This PR adds unit testing that fails without that fix.

This turns testLogSink into an implementation of SlogSink if slog is supported,
then runs through some scenarios where values get added using different APIs.
The end result gets compared by formatting with the slog JSON handler because
that is easier than writing custom code for a deep-equal comparison of slog
attributes.

The "with-group-and-logr-values" is the case which was broken.
@thockin thockin merged commit 5153ab2 into go-logr:master Dec 4, 2023
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants