logrus
Logrus is a structured logging library for Go that provides JSON and text formatters compatible with the standard library. It is in maintenance mode focusing on security and bug fixes, with the maintainer acknowledging newer alternatives like Zap and Zerolog are better suited for new projects.
Key facts
Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.
| Field | Value |
|---|---|
| Repository | sirupsen/logrus |
| Owner | sirupsen |
| Primary language | Go |
| License | MIT — OSI-approved |
| Stars | 25.8k |
| Forks | 2.3k |
| Open issues | 47 |
| Latest release | v1.9.4 (2026-01-15) |
| Last updated | 2026-06-29 |
| Source | https://github.com/sirupsen/logrus |
What logrus is
Logrus offers structured field-based logging with pluggable formatters (JSON, text, logfmt), hooks for integration with external services, and caller reporting. API is compatible with Go's stdlib logger. Performance overhead of caller reporting is 20–40% on Go 1.6–1.7 baseline.
Get the logrus source
Clone the repository and explore it locally.
git clone https://github.com/sirupsen/logrus.gitcd logrus# follow the project's README for install & configurationNeed it deployed, integrated, or customized instead? DEV.co ships production installs.
Best use cases
Implementation considerations
- Caller reporting (SetReportCaller) adds measurable latency; benchmark in your environment before enabling in production.
- Hooks are synchronous; slow or blocking hooks will delay log writes and potentially block application logic.
- Formatter selection (JSON vs. text) must be decided at initialization; no per-log-line formatter switching.
- Fields are copied per log entry; large field sets or frequent WithFields() calls may increase GC pressure in high-volume scenarios.
- No built-in log rotation; output file management must be handled separately or via external hook.
When to avoid it — and what to weigh
- High-throughput, latency-sensitive applications — Newer alternatives (Zap, Zerolog) offer significantly lower allocation and CPU overhead. Logrus is not optimized for microsecond-scale logging.
- Starting a new greenfield project — Maintainer explicitly recommends Zap, Zerolog, or Apex for new projects. Logrus design reflects pre-2019 Go logging practices.
- Requires active feature development or breaking API changes — Project is in maintenance mode; only security fixes, performance tuning, and slog interoperability are planned. No new major features expected.
- Structured logging with complex context propagation — No native support for context.Context. Thread-local or request-scoped field injection is manual and error-prone.
License & commercial use
MIT License: permissive, allows commercial use, modification, and distribution without restriction. No copyleft obligations.
MIT is a permissive OSI license. Commercial use, closed-source derivatives, and proprietary deployment are permitted. No license fee or attribution clause. Suitable for commercial products. Consult your legal team if bundling with other GPL-licensed code.
DEV.co evaluation signals
Editorial assessment — not user reviews. Directional, with an explicit confidence level.
| Signal | Assessment |
|---|---|
| Maintenance | Active |
| Documentation | Adequate |
| License clarity | Clear |
| Deployment complexity | Low |
| DEV.co fit | Good |
| Assessment confidence | High |
No known active vulnerabilities reported. Logrus does not perform cryptographic operations, network requests, or privilege escalation. Relevant considerations: sensitive fields should not be logged by default; custom hooks must validate external service endpoints; caller paths may leak internal code structure in logs. No formal security audit data provided.
Alternatives to consider
Zap (Uber)
High-performance structured logger optimized for low allocation and latency. Preferred for throughput-sensitive services. Steeper API learning curve.
Zerolog
Lightweight, fast structured logger with similar API surface. Lower memory overhead than Logrus. Growing adoption in new Go projects.
Slog (stdlib log/slog, Go 1.21+)
Official Go structured logging standard. No third-party dependency. Limited formatters and hooks compared to Logrus, but future-proof for stdlib-only stacks.
Build on logrus with DEV.co software developers
Logrus is a stable, proven structured logger for Go—ideal if you're migrating from stdlib logging or need hook-based integrations. For new high-performance services, compare Zap and Zerolog first. Let Devco help you assess fit for your architecture.
Talk to DEV.coRelated on DEV.co
Explore the category and the services that help you build with it.
logrus FAQ
Is Logrus still maintained?
Can I use Logrus in a production service?
How do I add structured fields to all logs from a request?
What's the overhead of SetReportCaller()?
Software development & web development with DEV.co
Need help beyond evaluating logrus? DEV.co is a software development agency offering software development services and web development for teams of every size. Our software developers and web developers build custom software, web applications, APIs, and open-source observability integrations — and maintain them long-term.
Evaluate Logrus for Your Go Stack
Logrus is a stable, proven structured logger for Go—ideal if you're migrating from stdlib logging or need hook-based integrations. For new high-performance services, compare Zap and Zerolog first. Let Devco help you assess fit for your architecture.