x/exp/slog: unexpected behavior when using NewJSONHandler #56087
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?GOARCH="amd64"
GOOS="darwin"
What did you do?
Using the
slog
package, ran the following program, as well as one withNewTextHandler
What did you expect to see?
For the first program, JSON parseable by
gojq
For the second program, a log message showing some error associating Agent Scully and a UFO
(I don't have the expectation that slog is anything but /x/exp, but just noticed these things)
What did you see instead?
For the first program:
this isn't parsed because there should be a [edit] a comma here:
"Eulerian Gophers","id"
. There is a similar glitch with TextHandler output, and I guess it's the preformatting.With("job", "Eulerian Gophers", "id", 1 )
eliminates the glitch.For the second program, using
Using JSON seems to avoid escaping the zero width joiner.
[edit: fixed a few details in description that were backwards]
The text was updated successfully, but these errors were encountered: