tint
slogmw
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
tint
- Slogor: The colorful slog handler is now stable with version 1.1.2!
-
Slog: Zero-dependency structured logging in Go
A guide covering how to write custom handlers is out of scope for this post, but you can find one such guide written by the author of slog here. Thankfully, you donβt need to write a handler from scratch to use one. There are several community-contributed handlers, including handlers that allow you to output colored logs, and a handler that lets you implement sampling. You can find a full list here.
- slog module, colorize output based on level
- [Golang] tint: π slog.Handler that writes tinted logs
- tint: π slog.Handler that writes tinted logs
slogmw
- Go structured logging log/slog middleware
-
Slogtest
The new structured logging library is a great addition, its nice to have structured logging in the standard lib.
It's easy to get started with log/slog and one of the built in handlers, but as soon as you want to change something the library design pushes you towards implementing an entire handler.
For example, if I was the built in JSON format, but with a different formatting of the Time field, that's not easy to do. It's not obvious how to change the built in handler.
I wrote slogmw[1] to solve this problem. It's a set of middleware and examples that make it easy to make small changes to the built in handlers without having to write a whole new handler from scratch.
[1] https://github.com/zknill/slogmw
- Middelware to make Go 1.21's new structured logger easier
What are some alternatives?
zax - Zap logger with context
slog-multi - π¨ Design workflows of slog handlers: pipeline, middleware, fanout, routing, failover, load balancing...
slog-sampling - π¨ slog sampling: drop repetitive log records
slog-gin - π¨ Gin middleware for slog logger
termenv - Advanced ANSI style & color support for your terminal applications
slog-sentry - π¨ slog: Sentry handler
kemba - A tiny debug logging tool. Ideal for CLI tools and command applications. Inspired by https://github.com/visionmedia/debug
zerolog - Zero Allocation JSON Logger
glo - Logging library for Golang
slog-formatter - π¨ slog: Attribute formatting
logrus - Structured, pluggable logging for Go.
phuslu/log - Fastest structured logging