-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from veqryn/replacers
Update readme with benchmarks, add package doc
- Loading branch information
Showing
2 changed files
with
61 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
Package slogjson lets you format your Golang structured logging [log/slog] usingthe JSON v2 | ||
library [github.com/go-json-experiment/json], with optional single-line pretty-printing. | ||
This is so much easier to read than the default json: | ||
{"time":"2000-01-02T03:04:05Z", "level":"INFO", "msg":"m", "attr":{"nest":1234}} | ||
or | ||
{"time": "2000-01-02T03:04:05Z", "level": "INFO", "msg": "m", "attr": {"nest": 1234}} | ||
Versus the default standard library JSON Handler: | ||
{"time":"2000-01-02T03:04:05Z","level":"INFO","msg":"m","attr":{"nest":"1234"}} | ||
Additional benefits: | ||
* JSON v2 is faster than the stdlib JSON v1 (up to 9x faster). | ||
* Can make use of all marshaling and encoding options JSON v2 has available. | ||
* Improved correctness and behavior with JSON v2. See: https://github.com/golang/go/discussions/63397 | ||
*/ | ||
package slogjson |