{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreigymjfwwpqiyfckeysqrycm2ekxqpnpj64rdnvf6auycqwxfybnci",
"uri": "at://did:plc:jfwxfgx3olblmdv66ysmcfde/app.bsky.feed.post/3mlgtvakdgeh2"
},
"path": "/Coding/2026/05/09/Type-safe-slogging.html?utm_medium=rss",
"publishedAt": "2026-05-09T16:03:40.000Z",
"site": "https://blog.x-way.org",
"tags": [
"Coding",
"article",
"Redowan Delowar",
"sloglint"
],
"textContent": "Well written article by Redowan Delowar, explaining how to achieve type-safe logging with Go's log/slog library.\n\n> * Take the logger as a constructor argument. Never reach for `slog.Default()` or any package-level slog function.\n> * Always use `logger.LogAttrs(ctx, level, msg, attrs...)`. Not `logger.Info`, `logger.Warn`, or any of the kv-flavored helpers.\n> * Every attribute comes from a helper in `internal/log/attrs.go`. Write `applog.OrderID(o.ID)`, never `slog.String(\"order_id\", o.ID)` inline.\n> * sloglint enforces all three on every commit so the workflow doesn’t erode.\n>\n\n\n* * *\n\nThanks for reading this post via RSS. You're awesome ♥️",
"title": "Type-safe slogging"
}