go-logging

Standardize structured logging in Go services using log/slog.

1|Updated Feb 19, 2026
One-click install
npx skills add https://github.com/juburr/mad-skills --skill go-logging
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go-logging
Source: https://github.com/juburr/mad-skills/tree/main/go-logging
Command: npx skills add https://github.com/juburr/mad-skills --skill go-logging

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Go projects often suffer from inconsistent logging across services, making it hard to diagnose issues and monitor production systems.

Core Features & Use Cases

  • Standardized use of log/slog for structured, typed attributes across HTTP handlers, workers, and background tasks.
  • Guidance on using middleware for HTTP request logging, error propagation practices, and dynamic log level control in production.
  • Examples and best practices for secure, observable logging in Go services.

Quick Start

Configure a Go service to use slog for structured logging and add HTTP request logging middleware.

Frequently Asked Questions about go-logging

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

FAQPage Schema
How do I set up structured logging in Go using slog?

To set up structured logging in Go, configure the log/slog package to emit typed attributes across HTTP handlers and workers. This standardizes logs across services, making production systems easier to monitor and diagnose.

What's the best way to add HTTP request logging middleware in Go services?

The best way to add HTTP request logging middleware in Go is by wrapping handlers to intercept requests and emit slog structured logs. This ensures consistent request tracking and error propagation practices across web services.

How does dynamic log level control work in Go production services?

Dynamic log level control in Go production services allows runtime adjustment of slog verbosity without redeployment. This is achieved through specific handler configurations, enabling responsive observability and security-conscious logging practices.

Can I use slog for logging across Go background tasks and workers?

Yes, you can use slog for logging across Go background tasks and workers. Standardizing structured, typed attributes across all service components ensures consistent observability for both HTTP handlers and asynchronous operations.

Why do my Go services have inconsistent logging across different deployments?

Go services have inconsistent logging across deployments when lacking a standardized structured logging approach. Applying log/slog with unified middleware instrumentation and typed attributes resolves this fragmentation, improving production monitoring.

Are there security best practices for structured logging in Go?

Security-conscious logging in Go involves applying best practices for structured logs to prevent sensitive data leaks. This includes using slog typed attributes and careful error propagation within HTTP middleware to ensure observable, safe production environments.