Updated Resources for slog (markdown)

Jonathan Amsterdam 2023-10-03 06:26:42 -04:00
parent 9429c6db76
commit d2626c6c35

@ -1,11 +1,6 @@
This page links to projects that use or enhance `slog`, the [proposed](https://go.dev/issue/56345) structured logging package for the standard library, accepted for Go 1.21.
This page links to projects that use or enhance [`slog`](https://pkg.go.dev/log/slog), the structured logging package for the standard library.
A preliminary implementation is at [golang.org/x/exp/slog](https://pkg.go.dev/golang.org/x/exp/slog). That won't be receiving any more updates;
instead, follow the `src/log/slog` directory of the [main Go repo](https://go.googlesource.com/go).
Since slog has been in flux for several months, some of these resources may be out of date and may not build. The API did not change that much, though, so fixes should be straightforward.
#### Log formatting:
#### Log formatting
- slog-formatter: Common formatters for slog + helpers for building your own: https://github.com/samber/slog-formatter
- ConsoleHandler (similar to Zap's ConsoleEncoder): https://gist.github.com/wijayaerick/de3de10c47a79d5310968ba5ff101a19
- logf (attr {key} interpolation, rich tty output): https://pkg.go.dev/github.com/AndrewHarrisSPU/logf (uses lazy Handler stores: https://go.dev/play/p/psdD7KDF5fp )
@ -14,18 +9,18 @@ Since slog has been in flux for several months, some of these resources may be o
- humane: a human-friendly (but still largely structured) slog Handler: https://github.com/telemachus/humane
- slug: a handler that prints colourful logs for humans: https://github.com/dotse/slug
#### Logger bridge:
#### Logger bridge
- Zap Handler, a slog handler that uses Zap: https://github.com/chanchal1987/zaphandler
#### Logging Middleware
- slog-dedup: deduplication of attribute keys for use with json logging: https://github.com/veqryn/slog-dedup
#### HTTP server middleware:
#### HTTP server middleware
- slog-gin: Gin middleware for slog logger: https://github.com/samber/slog-gin
- slog-echo: Echo middleware for slog logger: https://github.com/samber/slog-echo
- slog-fiber: Fiber middleware for slog logger: https://github.com/samber/slog-fiber
#### Log sink:
#### Log sinks
- Experimental example using both OpenTelemetry and `slog`: https://github.com/justinsb/experiments-slog
- Simple slog handler with opentelemetry tracing: https://github.com/ttys3/slogsimple/tree/main
- slog-datadog: a `slog.Handler` for Datadog: https://github.com/samber/slog-datadog
@ -44,9 +39,13 @@ Since slog has been in flux for several months, some of these resources may be o
- slog-kafka: a `slog.Handler` for Kafka: https://github.com/samber/slog-kafka
- slogdriver: a `slog.Handler` for Stackdriver Logging / GCP Cloud Logging: https://github.com/jussi-kalliokoski/slogdriver
#### Handlers
- github.com/veqryn/slog-dedup: handlers that deduplicate keys, with a variety of policies.
- slog-multi: chain of `slog.Handler` (pipeline, fanout, ...): https://github.com/samber/slog-multi
- various handlers: https://github.com/galecore/xslog
#### Other:
- Additional resources written by jba: https://github.com/jba/slog
- slog-multi: chain of `slog.Handler` (pipeline, fanout, ...): https://github.com/samber/slog-multi
- slog-sampling: drop repetitive log entries: https://github.com/samber/slog-sampling
- various handlers: https://github.com/galecore/xslog
- slog-context: adds support to reading values from context: https://github.com/PumpkinSeed/slog-context