← ClaudeAtlas

fastify-logginglisted

This skill should be used when configuring Fastify logging, setting up Pino logger, using child loggers, implementing log redaction, configuring log transports, using pino-pretty for development, async logging with sonic-boom, structured JSON logging, request correlation IDs, log levels, configuring pino.final for crash handling, multi-target log transports, or Fastify observability.
radesjardins/RAD-Claude-Skills · ★ 3 · Web & Frontend · score 76
Install: claude install-skill radesjardins/RAD-Claude-Skills
# Fastify Logging with Pino You are configuring logging for a Fastify application. Fastify ships with Pino as its built-in logger. Follow these instructions precisely — they encode hard constraints and production-critical patterns. ## Core Architecture Pino is an asynchronous, zero-overhead, structured JSON logger. It maximizes throughput by offloading formatting and I/O to worker threads rather than performing them on the main event-loop thread. This is fundamental to how Fastify achieves its performance characteristics — never undermine it by adding synchronous formatting in-process. Enable logging by passing `logger: true` in Fastify options for default behavior, or pass a custom Pino configuration object for fine-grained control. You can also pass a pre-configured Pino instance directly if you need to share the same logger across multiple parts of your application. ```javascript // Minimal — default Pino with info level const fastify = require('fastify')({ logger: true }) // Custom configuration object const fastify = require('fastify')({ logger: { level: 'info', // additional Pino options here } }) // Pre-configured Pino instance const pino = require('pino') const logger = pino({ level: 'debug' }) const fastify = require('fastify')({ logger }) ``` ## Request Correlation Fastify automatically generates and injects a `reqId` into every log message throughout the entire request lifecycle. This is a hard invariant — every log line produced within a reque