golang-samber-slog

Enhance Go logging with structured multi-handler pipelines and sampling.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires slog-multi, slog-sampling, slog-formatter, slog-fiber, slog-gin, slog-chi, slog-echo, slog-http, slog-betterstack, slog-channel, slog-datadog, slog-sentry, slog-loki, slog-syslog, slog-logstash, slog-graylog, slog-fluentd, slog-kafka, slog-logrus, slog-zap, slog-zerolog, slog-slack, slog-telegram, slog-webhook, slog-mattermost, slog-microsoft-teams, slog-nats, slog-otel, slog-parquet, slog-quickwit, slog-rollbar, slog-mock, and includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

This Skill facilitates structured logging for Golang applications, enhancing observability and maintainability with features like multi-handler pipelines, log sampling, and attribute formatting.

Core Features & Use Cases

  • Multi-Handler Pipelines: Compose log handlers in complex pipelines for routing and formatting.
  • Log Sampling: Implement sampling strategies to control log volume without losing critical information.
  • Attribute Formatting: Apply custom formatting to log attributes for better readability and analysis.
  • Use Case: As a developer, you can use this Skill to create a robust logging system for your Golang application, ensuring that all important events are logged while efficiently managing resource usage.

Quick Start

To apply this skill to your Golang project, add it as a dependency and configure your logger as per the documentation provided in the SKILL.md file.

Frequently Asked Questions about golang-samber-slog

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

FAQPage Schema
How do I implement structured logging in my Golang application?

You can implement structured logging in Golang by using samber/slog packages to compose multi-handler pipelines, apply custom attribute formatting, and manage log volume. This approach improves application observability and maintainability by ensuring all important events are logged efficiently.

What is the best way to route Golang logs to multiple destinations like Datadog and Loki?

The best way to route Golang logs to multiple destinations is by using multi-handler pipelines via slog-multi. This allows you to compose complex routing configurations, sending logs simultaneously to platforms like Datadog, Loki, and Sentry while managing resource usage.

Can I use samber/slog to migrate my existing logrus or zap logging setup?

Yes, you can migrate existing logging setups by utilizing the slog-logrus and slog-zap packages. These dependencies allow you to integrate samber/slog's structured logging capabilities into your current Golang project without completely replacing your underlying logging architecture.

How do I control log volume in high-traffic Golang applications?

You can control log volume in high-traffic Golang applications by implementing log sampling strategies with slog-sampling. This mechanism reduces the number of logs processed without losing critical information, effectively managing resource usage during peak traffic.

Does this structured logging approach work with web frameworks like Gin and Fiber?

Yes, this structured logging approach works seamlessly with web frameworks through dedicated packages like slog-gin, slog-fiber, slog-chi, and slog-echo. These handlers capture HTTP request data and feed it directly into your structured logging pipeline.

How do I format Golang log attributes for better readability?

You can format Golang log attributes for better readability by applying custom formatting rules with the slog-formatter package. This allows you to transform log attributes during the logging pipeline, ensuring outputs are optimized for analysis and maintainability.