Menu

Post image 1
Post image 2
Post image 3
1 / 3
0

slog Beyond Basics: Group, ReplaceAttr, and Custom Handlers

DEV Community·Gabriel Anhaia·25 days ago
#S6LRx21f
Reading 0:00
15s threshold

Book: The Complete Guide to Go Programming Also by me: Thinking in Go (2-book series) — Complete Guide to Go Programming + Hexagonal Architecture in Go My project: Hermes IDE | GitHub — an IDE for developers who ship with Claude Code and other AI coding tools Me: xgabriel.com | GitHub Most slog posts stop at slog.Info("hello", "user_id", 42) . That covers the first week. Then somebody opens a bug report asking why email is showing up in cleartext in CloudWatch, and a week later the SRE team asks why your error logs aren't reaching Sentry. slog has the answers wired into the API. They live in three corners of the package most posts skip: slog.Group , HandlerOptions.ReplaceAttr , and the Handler interface itself. This post is a tour of those three corners with patterns that survive real codebases: request-scoped grouping, PII redaction, source-path shortening, time formatting, error routing, and OpenTelemetry trace-id injection.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More