-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make slog attributes output the same content regardless of format (#3…
…9428) * Make slog attributes output the same content regardless of format There were a few instances of fmt.Stringers being passed to slog as attributes to delay their evaluation as per the performance considerations of slog: https://pkg.go.dev/log/slog#hdr-Performance_considerations. However, this resulted in the json handler emitting different content since they check to see if attributes are json.Marshalers and not fmt.Stringers. To rectify the situation, a new slog.LogValuer implementation was added that wraps a fmt.Stringer so that attributes can be lazily constructed while producing the same output no matter the log output format. * fix: wrap identity and correct typo
- Loading branch information
1 parent
3b50f5c
commit 5f2b52e
Showing
3 changed files
with
32 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters