---
name: "zerolog-zero-allocation-json-logger"
description: "Produce human-readable development logs and zero-allocation JSON logs with zerolog."
metadata:
  author: "Olivier Poitrey"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "configure zerolog"
  - "zerolog pretty console writer"
  - "contextual logger zerolog"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# zerolog JSON Logger with Dedicated Zero-Allocation API

Configures rs/zerolog: chaining fluent logging APIs (log.Info().Str('key', 'val').Msg('...')), global log level filtering, contextual loggers (logger.With()), and ConsoleWriter for pretty colored terminal output.

## When to Invoke
Invoke this skill whenever you need to:
- configure zerolog
- zerolog pretty console writer
- contextual logger zerolog

## Execution SOP & Rules
1. Initialize: zerolog.TimeFieldFormat = zerolog.TimeFormatUnix; log.Logger = log.Output(os.Stderr).
2. Fluent logging: log.Info().Str('service', 'billing').Int('retry', 2).Msg('Processing payment').
3. Create contextual sub-logger: sublogger := log.With().Str('component', 'auth').Logger().
4. Pretty print in development: log.Logger = log.Output(zerolog.ConsoleWriter{ Out: os.Stderr }).

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
