Last Updated: May 22, 2026
The classic log package, shipped with Go since day one, gives you Print and Printf and not much else. The newer slog package, added in Go 1.21, brings levels, structured key/value attributes, and pluggable handlers that emit JSON or text. This chapter covers both, with most of the time spent on slog since that's what new services use.