go/src/log
Jonathan Amsterdam 93b3035dbb src/log/slog: JSONHandler checks if error implements json.Marshaler
json.Marshal doesn't do what one might hope on many Go error values.
Errors created with errors.New marshal as "{}". So JSONHandler treats
errors specially, calling the Error method instead of json.Marshal.

However, if the error happens to implement json.Marshaler, then
JSONHandler should call json.Marshal after all. This CL makes
that change.

Change-Id: I2154246b2ca8fa13d4f6f1256f7a16aa98a8c24a
Reviewed-on: https://go-review.googlesource.com/c/go/+/480155
Run-TryBot: Jonathan Amsterdam <jba@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
2023-03-29 20:46:52 +00:00
..
slog src/log/slog: JSONHandler checks if error implements json.Marshaler 2023-03-29 20:46:52 +00:00
syslog log/syslog: return nil directly 2022-10-03 08:59:45 +00:00
example_test.go
log.go log: fix and cleanup trailing newline logic 2023-02-06 18:44:49 +00:00
log_test.go log: fix and cleanup trailing newline logic 2023-02-06 18:44:49 +00:00