golang-samber-slog-****

Compose samber/slog pipelines for sampling, sanitizing, and routing Go logs.

1|Updated May 27, 2026
One-click install
npx skills add https://github.com/dmwin72015/netdisk --skill golang-samber-slog-dmwin72015
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-samber-slog-****
Source: https://github.com/dmwin72015/netdisk/tree/main/.agents/skills/golang-samber-slog
Command: npx skills add https://github.com/dmwin72015/netdisk --skill golang-samber-slog-dmwin72015

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps you design high-signal, production-grade structured logging pipelines in Go by composing sampling, PII-safe formatting, routing, and HTTP/server context so logs stay accurate and cost-efficient.

Core Features & Use Cases

  • Structured pipeline composition: Use samber/slog-multi patterns (Router, Fanout, Pool, Failover, Pipe) to send each record to the right sink(s).
  • Noise control with sampling: Apply slog-sampling so high-volume Debug/Info logs are throttled while preserving visibility for important events.
  • PII and attribute transformation: Use slog-formatter middlewares (PIIFormatter, IPAddressFormatter, ErrorFormatter, and more) to sanitize and normalize log attributes before export.
  • HTTP request logging integration: Use samber/slog-gin, slog-echo, slog-fiber, slog-chi, or slog-http to attach request-scoped fields for downstream handlers.
  • Backend sink routing: Route records to sinks like Sentry, Loki, Datadog, Kafka, Slack, and others using standard slog.Handler interfaces and consistent constructors.

Quick Start

Use golang-samber-slog-**** to set up a Go slog pipeline where sampling is applied first, PII scrubbing is applied next, and a Router sends errors to Sentry while the rest go to Loki.

Frequently Asked Questions about golang-samber-slog-****

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build a structured logging pipeline in Go that samples logs and scrubs PII?

To build a structured logging pipeline in Go that samples logs and scrubs PII, compose samber/slog middlewares by applying slog-sampling first, then slog-formatter for sanitization, and route the records to sinks using slog-multi.

What is the correct ordering for slog sampling and formatting in Go production services?

The correct ordering for slog sampling and formatting requires sampling to be applied before formatting, ensuring high-volume logs are throttled prior to PII sanitization and deterministic routing via slog-formatter and slog-multi handlers.

Can I route Go slog records to different sinks like Sentry and Loki based on log level?

Yes, you can route Go slog records to different sinks like Sentry and Loki based on log level by using slog-multi Router with FirstMatch and Failover patterns to send errors to Sentry and standard records to Loki.

Does samber slog work with HTTP frameworks like Gin and Echo for request-aware logging?

Yes, samber slog works with HTTP frameworks like Gin and Echo by using slog-gin, slog-echo, slog-fiber, slog-chi, or slog-http middlewares to attach request-scoped fields for downstream handlers in production HTTP servers.

What's the best way to sanitize structured log attributes in Go before exporting to backends?

The best way to sanitize structured log attributes in Go before exporting to backends is using slog-formatter middlewares like PIIFormatter, IPAddressFormatter, and ErrorFormatter to normalize and scrub records within the slog pipeline.

When should I use slog-multi Failover and Fanout patterns in Go logging pipelines?

You should use slog-multi Failover and Fanout patterns in Go logging pipelines when you need backend sink routing to send records to multiple destinations simultaneously or handle sink failures gracefully without custom ad-hoc logging code.