DEV.co
Open-Source Observability · sirupsen

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.

Source: GitHub — github.com/sirupsen/logrus
25.8k
GitHub stars
2.3k
Forks
Go
Primary language
MIT
License (OSI-approved)

Key facts

Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.

FieldValue
Repositorysirupsen/logrus
Ownersirupsen
Primary languageGo
LicenseMIT — OSI-approved
Stars25.8k
Forks2.3k
Open issues47
Latest releasev1.9.4 (2026-01-15)
Last updated2026-06-29
Sourcehttps://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.

Quickstart

Get the logrus source

Clone the repository and explore it locally.

terminalbash
git clone https://github.com/sirupsen/logrus.gitcd logrus# follow the project's README for install & configuration

Need it deployed, integrated, or customized instead? DEV.co ships production installs.

Best use cases

Legacy Go services migrating from stdlib logging

Drop-in replacement for standard library logger; minimal refactoring required to adopt structured fields and formatters.

Parsing logs downstream (Logstash, Splunk, ELK)

Supports JSON and logfmt output formats directly; fields are machine-readable without custom parsing.

Small to medium Go applications with hook-based integrations

Built-in hooks enable syslog, Sentry, and custom downstream services; suitable for monolithic services without extreme performance constraints.

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.

SignalAssessment
MaintenanceActive
DocumentationAdequate
License clarityClear
Deployment complexityLow
DEV.co fitGood
Assessment confidenceHigh
Security considerations

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.

Software development agency

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.co

Related open-source tools

Surfaced by semantic similarity across the DEV.co open-source index.

logrus FAQ

Is Logrus still maintained?
Yes, but in maintenance mode. Security and bug fixes are applied. New major features are not planned, only slog interoperability work. For new projects, the maintainer recommends Zap or Zerolog.
Can I use Logrus in a production service?
Yes. Logrus is stable and widely deployed. However, evaluate performance requirements; if microsecond-scale logging latency matters, benchmark against Zap or Zerolog first.
How do I add structured fields to all logs from a request?
Use logger.WithFields() to create a logrus.Entry with default fields, then pass that Entry through your request handlers. No native context.Context support; manual threading required.
What's the overhead of SetReportCaller()?
20–40% latency increase per log line on Go 1.6–1.7. Newer Go versions may differ. Always benchmark in your environment before enabling in production.

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.