What problem does it solve?
This Skill helps you design structured Go logging pipelines using samber/slog-* packages so records flow through the right handlers (sampling, formatting, routing, and sinks) with minimal wasted CPU and correct error visibility.
Core Features & Use Cases
- Sampling-first pipeline: Drops noise early to reduce cost by placing slog-sampling as the outermost stage.
- PII-safe attribute formatting: Uses slog-formatter middleware to transform or redact attributes (e.g., PII and IP address fields) before emission.
- Composed routing to multiple backends: Uses slog-multi (Router/Fanout/Pipe patterns) to route records and selectively deliver error traffic to sinks like Sentry while routing others to Loki or stdout.
- HTTP middleware integration: Applies framework-specific HTTP middlewares (Gin/Chi/Fiber/FastHTTP/etc.) so request context attributes can be extracted via AttrFromContext by backend handlers.
- Backend sink readiness: Provides practical guidance for configuring and safely shutting down batch-oriented sinks (e.g., Loki/Datadog/Kafka/Parquet) to avoid losing buffered logs.
Quick Start
Use the golang-samber-slog skill to generate a Go slog pipeline that samples first, scrubs email/IP fields via slog-formatter, routes errors to Sentry and the rest to Loki using slog-multi Router, and includes the required handler shutdown/flush steps for buffered sinks.