OSS TanbouSign in with GitHub

build JSON or CBOR log events with a low-allocation chaining API in Go

About these scores

OSS scale score is an unbounded metric that log-compresses and weights Stars, Watchers, Forks, and Contributors. Discovery score is the current OSS scale score minus the score at discovery. Update pace is commits in the last 30 days, growth momentum is the OSS scale score difference within the recent observation window, and OSS health is a 0–100 rating based on available recency, Community Health, and release data.

Stars
12,514
Primary language
Go
License
MIT
Repository last updated
Oct 4, 2026
On this page

Overview

zerolog is a structured logging library for Go. Its chaining API adds typed fields and produces JSON or CBOR events with a low-allocation design. It also includes levels, sampling, hooks, context.Context and net/http integration, and a standard log/slog handler.

Features and best fit

Based on official documentation; not hands-on tested · Content checked:

Key features

Build structured events by chaining typed fields into JSON output

Calls such as log.Info().Str(...).Int(...).Msg(...) add typed context to a log event. JSON is the default format and CBOR is available through a build tag.

Sources: [2]

Combine sampling, hooks, context.Context, and slog integration

The library supports sampling, hooks, contextual fields, context.Context, net/http, and a log/slog Handler for integration with application logging.

Sources: [2]

Best fit

Fits Go services that prioritize compact structured JSON logs with low allocation overhead

It is useful for APIs and workers that emit logs frequently and want typed structured fields with efficient JSON output; ConsoleWriter is available for human-readable development output.

Sources: [2]

Before adoption

v1.35.1 declares Go 1.23; do not retain pooled Events or Arrays beyond their lifecycle

The v1.35.1 go.mod declares Go 1.23. Events and Arrays are reused through sync.Pool, so references must not be retained after Msg/Send or outside callbacks. The chaining API also emits nothing unless a terminal method such as Msg or Msgf is called, with no compile-time error, so wrappers should be covered by tests.

Sources: [3][2]

Official sources

  1. [1]rs/zerolog — GitHub repository(2026-10-06)
  2. [2]zerolog v1.35.1 — README(2026-10-06)
  3. [3]zerolog v1.35.1 — go.mod(2026-10-06)
  4. [4]zerolog MIT license(2026-10-06)
Supplemental curator note

The chaining API builds structured events efficiently from fields through Msg or Send. Events and arrays are pooled internally, so references must not escape callbacks or outlive their documented lifecycle.

Try it in 3 steps

  1. 1

    Get the source

    git clone --depth 1 https://github.com/rs/zerolog.git
  2. 2

    Enter the repository

    cd zerolog
  3. 3

    Check the official steps

    Continue with the commands in the README Installation, Quick Start, or Getting Started section.

    find . -maxdepth 1 -iname 'README*' -exec sed -n '1,220p' {} \; -quit
Check the official README

Growth

Growth trends · Last 30 days

12,514 Stars

Trend data is still being collected.

Development activity

Last 90 days · weekly

Commits (last 30 days)
3
Open PRs
44

Development activity is still being collected.

Built with

Categories and tags

GitHub data

GitHub dataView detailed GitHub data

GitHub Topics

  • logging
  • json
  • golang
  • structured-logging
  • zerolog
Stars
12,514
Forks
650
Watchers
74
Open issues
114
Contributors
170
Owner type
User
Primary language
Go
License
MIT
Repository last updated
Oct 4, 2026
Write a related article

Share a guide or use case for this OSS in Markdown. Articles are published after administrator approval.

Report incorrect information

Tell us if any listing information is incorrect or outdated.

After reading this page, do you know what to do next?