# Introduction {#introduction}


`zerolog` is a fast, simple logger dedicated to **JSON output**. Its chaining API
writes JSON (or CBOR) events while avoiding allocations and reflection, so the
hot path stays cheap under load.

These docs pair short, task-oriented guides with a **full Go API reference
generated from the zerolog source** at a pinned commit. The reference covers
every exported package, type, function, method and runnable example that ships
in the module.


## What zerolog optimises for {#what-zerolog-optimises-for}


- **Speed and low allocation** on the logging path.
- **Structured output** — every event is a JSON object, not a formatted string.
- **A small, composable API** — a `Logger` writes events, `Writer`s and `Hook`s
  extend behaviour, and `Level`s gate what is emitted.

Zerolog deliberately focuses on efficient structured logging. Human-readable
console output is available too, through the (intentionally slower)
`zerolog.ConsoleWriter`.


## Packages in this module {#packages-in-this-module}


The module ships more than the root logger:

- `github.com/rs/zerolog` — the core logger, levels, fields, encoders, hooks.
- `github.com/rs/zerolog/log` — a package-level global logger wired to `os.Stderr`.
- `github.com/rs/zerolog/hlog` — `net/http` middleware that attaches a logger to a request.
- `github.com/rs/zerolog/diode` — a non-blocking writer that drops on saturation.
- `github.com/rs/zerolog/journald` — a writer for systemd journal native protocol.
- `github.com/rs/zerolog/pkgerrors` — stack-trace capture for `github.com/pkg/errors`.
- `github.com/rs/zerolog/slog` — a bridge to the standard library `log/slog`.

Each package has its own page in the **Go API** tab, generated from source.


## Where these docs come from {#where-these-docs-come-from}


The guides are authored. The API reference is **generated by
[Sourcey](https://sourcey.com)** from the zerolog repository using Sourcey's
native `godoc` adapter, which reads Go source, doc comments and `Example`
functions directly. The build is reproducible: the source is pinned to a single
commit and the exact command is recorded in the build evidence shipped with
these docs.
