golang-samber-slog

Compose structured Go logging pipelines with samber/slog routing, sampling, and sinks.

Updated Mar 29, 2026
One-click install
npx skills add https://github.com/osmanozen/go-commerce --skill golang-samber-slog-osmanozen
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-samber-slog
Source: https://github.com/osmanozen/go-commerce/tree/main/.agents/skills/golang-samber-slog
Command: npx skills add https://github.com/osmanozen/go-commerce --skill golang-samber-slog-osmanozen

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Structured, composable logging pipelines for Go apps using samber/slog, enabling efficient routing, sampling, formatting, and multi-backend sinks.

Core Features & Use Cases

  • Modular pipelines built with slog-multi for routing, Pool, and Pipe patterns
  • Integrated sampling and formatting to minimize overhead while preserving critical logs
  • Real-world use: route errors to Sentry while streaming info to stdout in JSON, with PII scrubbing

Quick Start

Set up a minimal Go program that wires samber/slog-multi with a router and a sampling middleware, then log a sample message.

Frequently Asked Questions about golang-samber-slog

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

FAQPage Schema
How do I route Go logs to multiple backends like Sentry and stdout?

You can route Go logs to multiple backends by using slog-multi to build composable logging pipelines with Router and Pool patterns, directing errors to Sentry while streaming info to stdout in JSON.

How do I add PII scrubbing to a Go logging pipeline?

PII scrubbing in a Go logging pipeline is achieved by composing custom Pipe patterns with samber/slog, allowing you to intercept and sanitize sensitive fields before logs reach the backend sink.

What is the best way to reduce log volume in Go services without losing critical errors?

To reduce log volume in Go services, apply slog-sampling middleware within your structured logging pipeline to minimize overhead while preserving critical logs during high-throughput events.

Can I use slog-formatter to customize structured log output in Go?

Yes, you can integrate slog-formatter with samber/slog to apply custom formatting to your structured logs, ensuring consistent output across different backend sinks in your Go application.

Do I need slog-multi to build composable logging pipelines in Go?

You need slog-multi to build modular, composable logging pipelines in Go, as it provides the Router, Pool, and Pipe patterns required to wire routing, sampling, and formatting together efficiently.