Skip to content

Resources for slog

This page links to projects that use or enhance slog, the structured logging package for the standard library.

Log formatting

Logger bridge

  • Zap Handler, a slog handler that uses Zap: chanchal1987/zaphandler
  • zapr: starting with v1.3.0, both slog/logr and go-logr/logr APIs are supported by the same logger instance.

Logging Middleware

  • slog-context: store attributes or the logger in context, read any custom values from context: veqryn/slog-context
  • slog-context/otel: automatically read and add OpenTelemetry TraceID and SpanID to logs, and can set Span error code: github.com/veqryn/slog-context/otel
  • slog-dedup: deduplication and sorting of attribute keys, with multiple dedupe policies, useful for json logging: veqryn/slog-dedup

HTTP server middleware

Log sinks

Handlers

Other: