Pino - extremely fast and low overhead Node.js logger with JSON-native structured logging. 10x faster than Winston. Optimized for high-performance APIs and production environments. USE WHEN: user mentions "pino", "fast logging", "high performance logging", "fastify logging", asks about "fastest node.js logger", "JSON structured logging", "low overhead logging" DO NOT USE FOR: Winston logging - use `winston` instead, Python logging - use `python-logging` instead, Complex transport requirements - use `winston` instead

GitHub
安装命令
npx skhub add claude-dev-suite/pino
Markdown
SKILL.md

Pino Logger - Quick Reference

When to Use This Skill

  • Structured logging in Node.js applications
  • High-performance logging
  • Integration with log aggregation systems

Deep Knowledge: Use mcp__documentation__fetch_docs with technology: pino for comprehensive documentation.

Basic Setup

npm install pino pino-pretty

Essential Patterns

Logger Base

import pino from 'pino';

const logger = pino({
  level: process.env.LOG_LEVEL || 'info',
  transport: {
    target: 'pino-pretty',
    options: { colorize: true }
  }
});

logger.info('Server started');
logger.error({ err }, 'Failed to connect');

Child Logger

const childLogger = logger.child({
  module: 'auth',
  requestId: req.id
});

childLogger.info({ userId }, 'User authenticated');

Express Integration

import pinoHttp from 'pino-http';

app.use(pinoHttp({ logger }));

Fastify Integration

import Fastify from 'fastify';

const fastify = Fastify({
  logger: {
    level: 'info',
    transport: {
      target: 'pino-pretty'
    }
  }
});

Production Configuration

const logger = pino({
  level: 'info',
  formatters: {
    level: (label) => ({ level: label }),
  },
  timestamp: pino.stdTimeFunctions.isoTime,
  base: {
    pid: process.pid,
    hostname: os.hostname(),
  },
});

When NOT to Use This Skill

  • Complex multi-transport requirements: Winston offers more flexible transport system
  • Custom log formatting beyond JSON: Winston has more formatting options
  • Development-only logging: Built-in console is simpler for quick debugging
  • Python/Java projects: Use language-specific logging frameworks
  • Legacy apps expecting text logs: Pino is JSON-first, requires parsing tools

Anti-Patterns

Anti-PatternWhy It's BadSolution
Using pino-pretty in production2-3x performance penaltyOnly use in development, raw JSON in prod
Logging large objectsSerialization overheadLog only necessary fields
Synchronous loggingDefeats Pino's async advantageUse default async mode, avoid pino.final()
Nested child loggers without cleanupMemory leak over timeReuse child loggers or clear references
Logging in hot paths without level checkStill has minimal overheadUse if (logger.isLevelEnabled('debug')) for extreme cases
Mixing multiple logger instancesInconsistent configurationCreate one base logger, use child loggers

Quick Troubleshooting

IssueCauseSolution
Unreadable JSON in consoleNo pretty-printer configuredAdd pino-pretty transport for development
Performance slower than expectedpino-pretty enabled in productionRemove pretty-printer, use raw JSON
Missing logsLevel too highCheck level configuration matches environment
Context not includedNot using child loggerUse logger.child({ context }) for request scoping
Logs not flushing on exitAsync logging bufferUse pino.final() or flush on SIGTERM
Extra fields not appearingIncorrect syntaxUse object as first param: logger.info({ field }, 'msg')
发现
标签

此技能尚未发布标签。

版本
最新版本元数据

版本

v2026.09.24

发布时间

2026年9月24日

分类

未分类

许可证

MIT

源路径

skills/logging/pino

默认分支

main

最新提交

9496306

Tree SHA

fe4e2f1