log/slog package
Canonical docs for structured logging with handlers, attributes, groups, and logger composition.
Canonical docs for structured logging with handlers, attributes, groups, and logger composition.
- Author: Go Team
- Authority: primary
- Kind: package-doc
- URL: https://pkg.go.dev/log/slog
What it covers
- logger and handler APIs
- attribute shaping
- contextual structured logging
Why authoritative
Official package documentation for Go’s structured logging package.
Use when
- how should I use slog in Go
- how do I structure logs with slog
- should this logger use With or groups
Keywords
- slog, structured logging, log/slog, logger, handlers