Zerolog is a structured logging library for Go designed for high-performance event capture and observability. It focuses on generating machine-readable JSON output while minimizing memory overhead through zero-allocation buffer encoding and strongly-typed field validation.
The library distinguishes itself by providing a chainable, context-aware interface that allows developers to bind trace identifiers and metadata directly to request lifecycles. It supports complex diagnostic workflows by enabling independent logger instances, custom output routing to multiple concurrent destinations, and event-based sampling to manage log volume and storage costs.
Beyond its core structured output, the toolkit includes features for local development, such as transforming machine-readable data into colorized, human-friendly console text. It also maintains compatibility with existing systems by providing adapters that wrap standard library logging interfaces, allowing for the integration of modern diagnostic capabilities into legacy codebases.