Guide59.1K views3,609 votes0 replies1,244 following
Go's log/slog: Replacing Hand-Rolled JSON Loggers With the Standard Library
Go 1.21's log/slog replaces hand-rolled JSON loggers: a worked JSONHandler setup, runtime level changes with LevelVar, ReplaceAttr redaction, context trace IDs, and the !BADKEY and performance pitfalls to avoid.