Zerolog
github.com
1
Leaving SiteNav
External Link Disclaimer
You are about to visit github.com. This website is not operated by us. We are not responsible for its content or privacy practices.
About this website
Zerolog is a zero-allocation JSON logging library for Go, created and maintained by Olivier Poitrey (also known for creating the Caddy web server's TLS automation and the RS organization's Go libraries). The name reflects its core design principle: achieving zero memory allocations during logging operations, even for complex structured log entries. This makes Zerolog particularly well-suited for high-performance, low-latency applications where garbage collection pauses from logging can cause unacceptable latency spikes. In benchmarks, Zerolog consistently ranks as one of the fastest Go logging libraries, achieving sub-microsecond per-log overhead in the zero-allocation mode. The library uses a unique chained API design where each field addition returns a new logger context, allowing the compiler to optimize the call chain. Unlike Zap which uses interface{} and reflection in its SugaredLogger, Zerolog avoids this entirely by using specialized methods for each type (Str, Int, Bool, Float64, Dur, Time, Err, and more). Key features include: JSON as the primary output format (with optional ConsoleWriter for human-readable terminal output during development), zero-allocation logging by default with optional allocation for complex types, hierarchical loggers with context inheritance (child loggers inherit fields from parent loggers), configurable log levels (Trace, Debug, Info, Warn, Error, Fatal, Panic, NoLevel, Disabled), hook system for intercepting and modifying log events, automatic error and stack trace capture, sampling for high-frequency messages, sub-loggers for scoped context, support for custom field types via LogArrayMarshaler and LogObjectMarshaler interfaces, integration with the standard library log package, and support for syslog and system journal (journald) output. As of 2026, Zerolog has over 11,000 GitHub stars.
Tags & Categories
Categories
Tags
Statistics
1
Views
0
Clicks
0
Like
0
Dislike