Skip to content

log/slog: invalid LogAttrs examples #64519

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

Closed
3052 opened this issue Dec 2, 2023 · 2 comments
Closed

log/slog: invalid LogAttrs examples #64519

3052 opened this issue Dec 2, 2023 · 2 comments
Labels
Documentation Issues describing a change to documentation. FixPending Issues that have a fix which has not yet been reviewed or submitted. FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@3052
Copy link

3052 commented Dec 2, 2023

What did you do?

these are both invalid:

// A Handler should treat WithGroup as starting a Group of Attrs that ends
// at the end of the log event. That is,
//
// logger.WithGroup("s").LogAttrs(level, msg, slog.Int("a", 1), slog.Int("b", 2))
//
// should behave like
//
// logger.LogAttrs(level, msg, slog.Group("s", slog.Int("a", 1), slog.Int("b", 2)))

What did you expect to see?

as LogAttrs first takes a context:

https://godocs.io/log/slog#Logger.LogAttrs

@seankhliao seankhliao added Documentation Issues describing a change to documentation. NeedsFix The path to resolution is known, but the work has not been done. labels Dec 3, 2023
@bcmills
Copy link
Contributor

bcmills commented Dec 4, 2023

attn @jba

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/547215 mentions this issue: log/slog: correct doc examples for Handler.WithGroup

@dmitshur dmitshur modified the milestones: Backlog, Go1.22 Dec 5, 2023
@dmitshur dmitshur added the FixPending Issues that have a fix which has not yet been reviewed or submitted. label Dec 5, 2023
ezz-no pushed a commit to ezz-no/go-ezzno that referenced this issue Feb 18, 2024
Fixes golang#64519

Change-Id: Iaea5de74402b77eb5a42979bd3baa1276b13d585
GitHub-Last-Rev: 5080a25
GitHub-Pull-Request: golang#64551
Reviewed-on: https://go-review.googlesource.com/c/go/+/547215
Reviewed-by: Bryan Mills <[email protected]>
Reviewed-by: Jonathan Amsterdam <[email protected]>
Run-TryBot: Jes Cok <[email protected]>
TryBot-Result: Gopher Robot <[email protected]>
@golang golang locked and limited conversation to collaborators Dec 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Documentation Issues describing a change to documentation. FixPending Issues that have a fix which has not yet been reviewed or submitted. FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants