log: remove custom json and logfmt handlers #28638
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Potential follow-up to #28622
This PR removes our custom
jsonandlogfmtimplementations, to instead use the ones built intoslog. Ours does some transformations under the hood, mainly renamingtimetotandleveltolvl, and de-capitalizing the levels.It also does away with the custom key-value pair "filling". Instead of
key=<nil> LOG_ERROR="Normalized odd number of arguments by adding nil"slog simply saysBADKEY=keyThe one other thing worth mentioning is that this makes the json output spit out
*big.Inttypes as json-native numeric format, e.g111222333444555678999instead of"111222333444555678999". When trying to read that back intoany, the unmarshaller selectsfloat64, which cannot read it fully correct on the way back.I think it would be better to switch over to
slog, if we believe that slog is some kind of go-idiomatic future of logging. A few of our users may potentially have to switch over their parsing, but all in all it's probably not a great amount of work, and probably something that's better done sooner rather than later.