Skip to main content
skill CX Codex

pino-logging — Claude Code skill: Pino logging and installation

Set up structured Pino logging in Node.js, including request context, sensitive-field redaction, transports, and framework integrations.

MIT 217 installs ★ 29 updated 2026-08-17

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add oakoss/agent-skills --skill pino-logging -a claude-code
Open on GitHub

What pino-logging does

This skill covers Pino configuration for JSON logging in Node.js. It explains log levels, child loggers that retain request context, error serialization, and redaction of sensitive fields. For HTTP request logs, it covers pino-http and generating or forwarding X-Request-Id.

The transport guidance includes worker-thread execution, routing logs to multiple destinations, and writing to files. It also shows integrations with Fastify and Hono, along with output formatters and custom levels. pino-pretty is presented for development; production guidance favors JSON output instead.

The material targets server-side Node.js projects using pino version 10 or later. Browser support is limited, and transports shipped as separate packages need to be installed as dependencies.

What it helps with

  • configure JSON logs with a chosen level
  • attach request IDs and context to HTTP logs
  • redact passwords and tokens from log output
  • route logs to multiple destinations
  • add Pino logging to Fastify or Hono

Example prompts for the agent

  • Set up Pino JSON logging for my Node.js application.
  • Add request-scoped context and handle X-Request-Id with pino-http.
  • Show how to redact passwords and tokens and write logs to a file.

How to install pino-logging

1Skills CLI (Vercel)

npx skills add oakoss/agent-skills --skill pino-logging -a claude-code

2Manually: put the files in place

~/.claude/skills/pino-logging/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/pino-logging/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about pino-logging

How do I install pino-logging in Claude Code?

Run npx skills add oakoss/agent-skills --skill pino-logging -a claude-code. The skill file will be at ~/.claude/skills/pino-logging/SKILL.md.

What does pino-logging do?

It guides Pino setup for structured Node.js logs, covering request context, sensitive-field redaction, transports, and framework integrations.

Can I use pino-logging for a browser-only project?

The skill is aimed at server-side Node.js applications. Pino has limited browser support.

Source text

SKILL.md · MIT
---
name: pino-logging
description: 'Pino high-performance JSON logger for Node.js with worker thread transports, child loggers, redaction, and framework integrations. Use when setting up structured logging, configuring log transports, adding request correlation IDs, redacting sensitive data, or integrating with Fastify, Hono, or Express. Use for pino, logging, structured-logs, request-id, correlation, redaction, transports, pino-http, pino-pretty.'
license: MIT
metadata:
  author: oakoss
  version: '1.0'
  source: 'https://github.com/pinojs/pino'
user-invocable: false
---

# Pino Logging

High-performance JSON logger for Node.js. Transports run in worker threads to keep the main event loop free. Produces NDJSON by default with automatic `level`, `time`, `pid`, `hostname`, and `msg` fields.

**When to use:** Structured logging in Node.js applications, request-scoped logging with correlation IDs, sensitive data redaction, multi-destination log routing, framework logging integration.

**When NOT to use:** Browser-only logging (pino has limited browser support), simple `console.log` debugging during development, projects that need human-readable logs by default (pino outputs JSON; use `pino-pretty` for dev).

**Package:** `pino` (v10+)

## Quick Reference

| Pattern             | API                                 | Key Points                                    |
| ------------------- | ----------------------------------- | --------------------------------------------- |
| Basic logger        | `pino()`                            | Defaults: level `info`, JSON to stdout        |
| Set level           | `pino({ level: 'debug' })`          | `fatal > error > warn > info > debug > trace` |
| Log with context    | `logger.info({ userId }, 'msg')`    | First arg is merged object, second is message |
| Error logging       | `logger.error({ err }, 'failed')`   | Pass errors as `err` key for serialization    |
| Child logger        | `logger.child({ requestId })`       | Bindings persist on all child logs            |
| Redaction           | `pino({ redact: ['password'] })`    | Paths use dot notation, supports wildcards    |
| Transport (worker)  | `pino({ transport: { target } })`   | Runs in worker thread, non-blocking           |
| Multiple transports | `transport: { targets: [...] }`     | Different levels per destination              |
| Pretty print (dev)  | `target: 'pino-pretty'`             | Dev only — not for production                 |
| File transport      | `target: 'pino/file'`               | Built-in, with `mkdir` option                 |
| Rotating files      | `target: 'pino-roll'`               | Size and time-based rotation                  |
| HTTP middleware     | `pinoHttp()` from `pino-http`       | Auto request/response logging                 |
| Request ID          | `genReqId` option in pino-http      | Generate or forward `X-Request-Id`            |
| Serializers         | `serializers: { req, res, err }`    | Transform objects before logging              |
| Formatters          | `formatters: { level, log }`        | Rename fields, transform output               |
| Custom levels       | `customLevels: { http: 35 }`        | Add levels between built-in ones              |
| Async destination   | `pino.destination({ sync: false })` | Buffered async writes                         |
| Fastify             | `fastify({ logger: true })`         | Built-in pino, `request.log`                  |
| Hono                | `hono-pino` middleware              | `c.get('logger')` in handlers                 |

## Common Mistakes

| Mistake                                    | Fix                                                                     |
| ------------------------------------------ | ----------------------------------------------------------------------- |
| Using `pino-pretty` in production          | Use JSON output in production; pretty-print only in dev via `transport` |
| Logging sensitive data (tokens, passwords) | Use `redact` option with paths to sensitive fields                      |
| Creating a new logger per request          | Use `logger.child({ requestId })` for request-scoped context            |
| Blocking main thread with file writes      | Use `pino.transport()` — runs in a worker thread                        |
| Using `JSON.stringify` on errors           | Pass errors as `{ err }` — pino serializes stack, cause chain           |
| Not forwarding `X-Request-Id` header       | Use `genReqId` in pino-http to check headers first                      |
| Logging inside hot loops                   | Check `logger.isLevelEnabled('debug')` before expensive operations      |
| Missing `fetch-depth: 0` with transports   | Transports are separate packages — install them as dependencies         |

## Delegation

> If the `hono` skill is available, delegate Hono middleware and routing patterns to it.
> If the `vitest-testing` skill is available, delegate test setup and mocking patterns to it.
> If the `sentry-setup-logging` skill is available, delegate Sentry integration to it — it covers `Sentry.pinoIntegration()` for forwarding pino logs to Sentry.
> Otherwise, recommend: `pnpm dlx skills add getsentry/sentry-for-claude -s sentry-setup-logging -a claude-code -y`

## References

- [Setup, configuration, and core API](references/setup-and-configuration.md)
- [Transports, destinations, and log routing](references/transports.md)
- [Child loggers, serializers, and redaction](references/child-loggers-and-redaction.md)
- [HTTP logging, correlation IDs, and framework integrations](references/http-and-frameworks.md)

© oakoss · MIT · oakoss/agent-skills

Similar skills

All skills for Backend and APIs →

From the same set106

The whole set →
content-humanizer content-humanizer rewrites model-written drafts so they read like a person wrote them: sentence rhythm, tone, and the hedging that gives AI text away. CX Codex +1 225installs zod-validation zod-validation guides AI coding agents through Zod v4 schema validation in TypeScript. Helps write schemas, parse incoming payloads, and generate JSON Schema definitions. CX Codex +1 222installs tanstack-form This skill guides TanStack Form v1 usage in React, covering state, validation, and submission. Use it for complex forms and changing field lists. CX Codex +1 222installs knowledge-graph-builder The knowledge-graph-builder skill guides knowledge-graph design, graph database choice, and graph-plus-vector retrieval. Use it for Graph RAG, entity resolution, and fact checks. CX Codex +1 222installs database-security database-security audits the data layer of Supabase, Postgres and Convex apps: RLS coverage, policy holes, service-role leaks, audit logging. Useful before a release or after an incident. CX Codex +1 208installs typescript-patterns Provides advanced strict-mode TypeScript patterns to enforce type safety and stop runtime errors before code runs. CX Codex +1 202installs react-patterns react-patterns is a Claude Code skill that covers React 19 patterns, state choices, data loading with use(), and reducing needless re-renders when building or reviewing components. CX Codex +1 201installs ci-cd-architecture ci-cd-architecture is a Claude Code skill for planning CI/CD pipelines, comparing deployment platforms, and securing GitHub Actions. It supports preparing a project for production or changing its delivery setup. CX Codex +1 199installs

Project sponsors

Companies that keep this analytics open