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

  • slogctx: 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
  • slogdedup: deduplication and sorting of attribute keys, with multiple policies, useful for json logging. Convenience methods to output for Stackdriver, Graylog, and others: veqryn/slog-dedup

HTTP server middleware

Log sinks

Handlers

Other: