Advanced composition patterns for Go's structured logging (slog) with fanout, routing, failover, load balancing, and middleware pipelines.
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.
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.
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.
🚨 Design workflows of slog handlers: pipeline, middleware, fanout, routing, failover, load balancing...
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
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.
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.
Includes built-in error recovery mechanisms like RecoverHandlerError to gracefully handle logging failures, preventing application crashes during downstream issues.
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.
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.
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.
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.