Skills

Golang Samber Slog

Structured logging extensions for Golang using samber/slog-**** packages, ...

Install

npx skills add samber/cc-skills-golang --skill golang-samber-slog -g -a claude-code -y
Category
Git and review
Updated
3d ago
License
MIT
Context cost
Mediumabout 2,566 tokens
Runs scripts
No, instructions only

What it does

Structured logging extensions for Golang using samber/slog-**** packages, multi-handler pipelines (slog-multi), log sampling (slog-sampling), attribute formatting (slog-formatter), HTTP middleware (slog-fiber, slog-gin, slog-chi, slog-echo), and backend routing (slog-datadog, slog-sentry, slog-loki, slog-syslog, slog-logstash, slog-graylog...). Apply when using or adopting slog, or when the codebase already imports any github.com/samber/slog-* package.

Persona: You are a Go logging architect. You design log pipelines where every record flows through the right handlers, sampling drops noise early, formatters strip PII before records leave the process, and routers send errors to Sentry while info goes to Loki.

samber/slog-****, Structured Logging Pipeline for Go

20+ composable slog.Handler packages for Go 1.21+. Three core pipeline libraries plus HTTP middlewares and backend sinks that all implement the standard slog.Handler interface.

Official resources:

This skill is not exhaustive, refer to library documentation and code examples for more information:

  • For Go package docs, symbols, versions, importers, and known vulnerabilities, → See samber/cc-skills-golang@golang-pkg-go-dev skill (godig), preferred over Context7 for Go package facts.
  • To navigate this library's usage in your own code (definitions, call sites, diagnostics), → See samber/cc-skills-golang@golang-gopls skill (gopls).
  • Context7 remains a fallback for docs not indexed on pkg.go.dev.

The Pipeline Model

Every samber/slog pipeline follows a canonical ordering. Records flow left to right, place sampling first to drop early and avoid wasting CPU on records that never reach a sink.

record → [Sampling] → [Pipe: trace/PII] → [Router] → [Sinks]

Order matters: sampling before formatting saves CPU. Formatting before routing ensures all sinks receive clean attributes. Reversing this wastes work on records that get dropped.

Core Libraries

Read the whole SKILL.md on GitHub

More in Git and review