Cette page est affichée en anglais. Une traduction française est en cours.
ScriptsJul 16, 2026·3 min de lecture

pino — Super Fast Node.js Logger

Low-overhead JSON logger for Node.js that uses worker threads for transport, delivering 5x the throughput of alternatives.

Prêt pour agents

Installation agent prête

Cet actif peut être installé après choix du runtime, vérification du plan et exécution de la commande adaptée.

Native · 98/100Policy : autoriser
Surface agent
Tout agent MCP/CLI
Type
Skill
Installation
Single
Confiance
Confiance : Established
Point d'entrée
pino Overview
Commande d'installation directe
npx -y tokrepo@latest install c22f6ed8-8135-11f1-9bc6-00163e2b0d79 --target codex

À exécuter après confirmation du plan en dry-run.

Introduction

pino is a low-overhead JSON logger for Node.js designed for production workloads. It achieves throughput 5x higher than alternatives like Winston and Bunyan by writing structured JSON to stdout and offloading formatting to separate transport processes. This design keeps the event loop free and logging fast.

What pino Does

  • Outputs structured JSON logs to stdout with minimal serialization overhead
  • Supports standard log levels: trace, debug, info, warn, error, fatal
  • Offloads log transport and formatting to worker threads or child processes
  • Provides child loggers that inherit and extend parent context
  • Redacts sensitive fields like passwords and tokens from log output

Architecture Overview

pino writes newline-delimited JSON (NDJSON) to a file descriptor using synchronous writes that bypass the Node.js stream machinery. Formatting, filtering, and delivery to external systems happen in separate transport workers via pino.transport(), which runs in a worker thread with its own event loop. This architecture means logging never blocks the main application thread, even under high throughput.

Setup & Configuration

  • Install via npm install pino and optionally pino-pretty for development formatting
  • Set the log level with pino({ level: 'info' }) or the LOG_LEVEL environment variable
  • Use pino.transport({ target: 'pino-pretty' }) for human-readable dev output
  • Configure redaction with pino({ redact: ['password', 'token'] })
  • Create child loggers with logger.child({ requestId: 'abc' }) for per-request context

Key Features

  • 5x faster than Winston and Bunyan in benchmarks
  • Worker-thread transports keep the event loop unblocked
  • Built-in field redaction for GDPR and security compliance
  • Child loggers with inherited context for request tracing
  • Ecosystem of 50+ community transports (Elasticsearch, Datadog, Loki, file rotation)

Comparison with Similar Tools

  • Winston — pluggable transports in-process, pino offloads transports to workers for better performance
  • Bunyan — JSON-first like pino but slower; Bunyan CLI for viewing, pino uses pino-pretty
  • Loguru (Python) — similar philosophy of simple structured logging but for Python, not Node.js
  • console.log — no structure, no levels, no redaction; pino adds all of these with minimal overhead

FAQ

Q: Why does pino output JSON instead of plain text? A: JSON is machine-parseable, making it easy to ingest into log aggregation systems. Use pino-pretty for human-readable output during development.

Q: How do I send pino logs to Elasticsearch or Datadog? A: Use a transport like pino-elasticsearch or pino-datadog-transport configured via pino.transport().

Q: Can I use pino with Express or Fastify? A: Yes. Fastify uses pino as its default logger. For Express, use pino-http middleware.

Q: Does pino support log rotation? A: Use the pino-roll transport or pipe stdout to a rotation tool like logrotate.

Sources

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires