Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Go
  3. slog-multi

slog-multi

MITGov1.8.0

Advanced composition patterns for Go's structured logging (slog) with fanout, routing, failover, load balancing, and middleware pipelines.

Visit WebsiteGitHubGitHub
631 stars27 forks0 contributors

What is slog-multi?

slog-multi is a Go library that extends the standard library's structured logging (slog) by providing advanced handler composition patterns. It enables developers to build complex logging workflows for production systems, solving problems like log distribution, conditional routing, high availability, and data transformation.

Target Audience

Go developers building production-grade applications who need sophisticated logging strategies beyond basic slog handlers, such as those requiring redundancy, conditional routing, or log transformation pipelines.

Value Proposition

Developers choose slog-multi for its enterprise-grade logging patterns that remain idiomatic to Go's slog ecosystem, offering unique composition strategies like fanout, routing, failover, and pipelining not available in the standard library.

Overview

🚨 Design workflows of slog handlers: pipeline, middleware, fanout, routing, failover, load balancing...

Use Cases

Best For

  • Building high-availability logging systems with automatic failover to backup handlers
  • Distributing logs to multiple destinations (like Logstash, Datadog, and stderr) in parallel for redundancy
  • Conditionally routing logs based on criteria like log level, attributes, or business logic (e.g., errors to Slack, info to console)
  • Transforming and filtering logs through middleware chains for data privacy, GDPR compliance, or enrichment
  • Load balancing logging traffic across multiple handlers to increase throughput and provide redundancy
  • Gracefully handling logging failures without crashing the application using error recovery mechanisms

Not Ideal For

  • Applications with straightforward logging needs that are fully served by slog's standard handlers without composition
  • Performance-sensitive systems where minimizing logging latency is critical, as additional layers can introduce overhead
  • Teams using alternative logging frameworks like Zap or Logrus without plans to adopt slog
  • Projects requiring plug-and-play logging with minimal configuration, as slog-multi demands careful setup of handlers and patterns

Pros & Cons

Pros

Advanced Composition Patterns

Provides unique strategies like fanout for parallel logging, routing based on criteria, and failover for high availability, as shown in the README examples for distributing logs to multiple destinations.

Seamless slog Integration

Idiomatically extends Go's standard slog library, allowing developers to use existing slog handlers and options without friction, evidenced by compatibility with Go >= 1.21 and no breaking changes before v2.0.0.

Error Resilience

Includes built-in error recovery mechanisms like RecoverHandlerError to gracefully handle logging failures, preventing application crashes during downstream issues.

Flexible Middleware Support

Offers inline middleware and custom handler shortcuts, enabling rapid implementation of transformation logic such as data redaction or enrichment, as demonstrated in the pipelining examples.

Cons

Configuration Complexity

Setting up advanced patterns like routers or pipelines requires a deep understanding of slog handlers and can be error-prone for newcomers, with multiple steps shown in the usage examples.

Performance Trade-offs

The library adds processing layers; as warned in the README, excessive logging with multiple handlers can significantly impact application performance, making it costly in high-throughput scenarios.

Ecosystem Dependency

For many practical use cases, it relies on external handler libraries from the samber ecosystem (e.g., slog-datadog, slog-slack), increasing dependency management overhead and potential versioning issues.

Frequently Asked Questions

Quick Stats

Stars631
Forks27
Contributors0
Open Issues2
Last commit23 days ago
CreatedSince 2023

Tags

#slog#error#observability#logging-framework#handler#log#failover#logger#structured-logging#golang#attribute#go#middleware#log-level

Built With

G
Go

Links & Resources

Website

Included in

Go169.1k
Auto-fetched 18 hours ago

Related Projects

logruslogrus

Structured, pluggable logging for Go.

Stars25,751
Forks2,286
Last commit25 days ago
zapzap

Blazing fast, structured, leveled logging in Go.

Stars24,583
Forks1,536
Last commit2 months ago
zerologzerolog

Zero Allocation JSON Logger

Stars12,481
Forks633
Last commit1 day ago
spewspew

Implements a deep pretty printer for Go data structures to aid in debugging

Stars6,400
Forks374
Last commit2 years ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub