github.com/sirupsen/logrus ↗
Structured, pluggable logging for Go.
Open this visualization on its own page →
Contributors
287
Lines of Code
1,353
From
2013-10-16
To
2023-06-06
About sirupsen/logrus
Logrus is a structured logging library for Go that provides an API compatible with the standard library's logger. It encourages developers to use structured fields instead of formatted strings, making logs more parseable and queryable. The library supports multiple output formats including colored text for development, JSON for log aggregation platforms like Logstash and Splunk, and logfmt format for machine parsing.
The project includes several key features for production use: seven logging levels from Trace to Panic, customizable hooks for routing messages to external services, multiple built-in and third-party formatters, and the ability to attach default fields to log entries. Logrus can function as an io.Writer, allowing it to replace the standard library logger, and it includes testing facilities through a test hook for asserting log messages. The library is thread-safe by default with mutex protection, though this can be disabled if needed.
Logrus is now in maintenance mode, focusing on security, bug fixes, and performance improvements rather than new features. The maintainer acknowledges that the project helped establish structured logging as a standard practice in Go but notes that the community has since created alternatives like Zerolog, Zap, and Apex that incorporate lessons learned. The library remains widely used and actively maintained for compatibility with modern Go logging ecosystems.