golang-samber-slog

Automate structured logging pipelines in Go with samber/slog middleware and routing.

Updated Jul 3, 2026
One-click install
npx skills add https://github.com/constzz/dates-app --skill golang-samber-slog-constzz
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: golang-samber-slog
Source: https://github.com/constzz/dates-app/tree/main/.agents/skills/golang-samber-slog
Command: npx skills add https://github.com/constzz/dates-app --skill golang-samber-slog-constzz

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires github.com/samber/slog, github.com/samber/slog-multi, github.com/samber/slog-sampling, github.com/samber/slog-formatter, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill streamlines Go logging by providing a structured logging system with advanced middleware options, making it easier to manage and route logs effectively.

Core Features & Use Cases

  • Structured Logging: Implement structured logging with samber/slog packages, enhancing the ability to parse and analyze logs.
  • Middleware Chain: Utilize middleware for PII scrubbing, trace injection, and more.
  • Routing and Sinks: Configure routers and sinks for different log levels and destinations like Sentry, Loki, and more.
  • Use Case: For a Go application, use this Skill to set up a logging pipeline that routes errors to Sentry and info logs to Loki, with PII scrubbing and trace injection.

Quick Start

To use the golang-samber-slog skill, first set up the required samber/slog packages in your Go project and then configure your logger as per the Skill's documentation.

Frequently Asked Questions about golang-samber-slog

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

FAQPage Schema
How do I set up a structured logging pipeline in Go using samber/slog?▼

To set up a structured logging pipeline in Go, configure your logger using samber/slog packages to establish efficient log handling, middleware chaining, and flexible routing to various sinks.

Can I route different log levels to separate destinations like Sentry and Loki in Go?▼

Yes, you can route different log levels to separate destinations like Sentry and Loki by configuring routers and sinks within your Go structured logging pipeline using samber/slog.

How do I add middleware for PII scrubbing and trace injection to Go logs?▼

You add middleware for PII scrubbing and trace injection to Go logs by utilizing the middleware chaining capabilities of the slog-multi package within your logging pipeline configuration.

Do I need to install specific Go packages before configuring samber/slog?▼

Yes, you need a Go environment with the required samber/slog packages installed, including slog-multi, slog-sampling, and slog-formatter, before configuring your structured logger.

What is the best way to handle high-volume Go application logs without losing important errors?▼

The best way to handle high-volume Go application logs is using slog-sampling for efficient log handling and routing errors to dedicated sinks like Sentry while sending general info logs elsewhere.

Why use a structured logging pipeline instead of standard Go logging?▼

You use a structured logging pipeline instead of standard Go logging to enhance the ability to parse and analyze logs, apply middleware for PII scrubbing, and route logs flexibly.