3 ms·
The blessed interface for libraries is to accept a slog.Logger. The blessed interface for logging backends is slog.Handler. Applications can then wire that up
by arccy 1y ago
The blessed interface for libraries is to accept a slog.Logger.
The blessed interface for logging backends is slog.Handler.
Applications can then wire that up with a handler they like, for example
zap: https://pkg.go.dev/go.uber.org/zap/exp/zapslog#Handler https://pkg.go.dev/go.uber.org/zap/exp/zapslog#Handler
charm https://github.com/charmbracelet/log?tab=readme-ov-file#slog-handler https://github.com/charmbracelet/log?tab=readme-ov-file#slog...
- trenchpilgrim 1y agoI used slog.Logger for an OSS project and I will not do it again. The interface is terrible, and far more verbose and less expressive than something like Zap or zerolog. e.g. there's not really anything as good as zerolog's log.Dict() for dealing with complex structures.