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
npx skills add oakoss/agent-skills --skill pino-logging -a claude-codeWhat 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-Idwithpino-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-code2Manually: put the files in place
~/.claude/skills/pino-logging/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/pino-logging/
1Skills CLI (Vercel)
npx skills add oakoss/agent-skills --skill pino-logging -a codex2Manually: put the files in place
.agents/skills/pino-logging/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add oakoss/agent-skills --skill pino-logging -a cursor2Manually: put the files in place
.cursor/skills/pino-logging/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install oakoss/agent-skills skills/pino-logging2Manually: put the files in place
.github/skills/pino-logging/SKILL.md1Skills CLI (Vercel)
npx skills add oakoss/agent-skills --skill pino-logging -a gemini-cli2Platform CLI
gemini skills install https://github.com/oakoss/agent-skills --path skills/pino-loggingManually: put the files in place
.devin/skills/pino-logging/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add oakoss/agent-skills --skill pino-logging -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
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