### Install Fastify Request Logger and Pino Pretty Compact Source: https://github.com/mgcrea/fastify-request-logger/blob/master/README.md Instructions for installing the `@mgcrea/fastify-request-logger` and `@mgcrea/pino-pretty-compact` packages using npm or pnpm. These packages are essential for the logger's functionality and log prettification. ```bash npm install @mgcrea/fastify-request-logger @mgcrea/pino-pretty-compact --save ``` ```bash pnpm add @mgcrea/fastify-request-logger @mgcrea/pino-pretty-compact ``` -------------------------------- ### Configure and Register Fastify Request Logger Source: https://github.com/mgcrea/fastify-request-logger/blob/master/README.md This TypeScript example demonstrates how to set up a Fastify instance, configure its logger using `@mgcrea/pino-pretty-compact` for pretty output, disable Fastify's default request logging, and register the `fastifyRequestLogger` plugin for compact request logging. ```typescript import createFastify, { FastifyInstance, FastifyServerOptions } from "fastify"; import fastifyRequestLogger from "@mgcrea/fastify-request-logger"; import prettifier from "@mgcrea/pino-pretty-compact"; export const buildFastify = (options: FastifyServerOptions = {}): FastifyInstance => { const fastify = createFastify({ logger: { level: "debug", transport: { target: "@mgcrea/pino-pretty-compact", options: { translateTime: "HH:MM:ss Z", ignore: "pid,hostname" } } }, disableRequestLogging: true, ...options }); fastify.register(fastifyRequestLogger); return fastify; }; ``` -------------------------------- ### FastifyRequestLogger Plugin Options Source: https://github.com/mgcrea/fastify-request-logger/blob/master/README.md Defines the available configuration options for the `fastifyRequestLogger` plugin. These options allow control over logging request bodies, adding custom bindings, ignoring specific paths, and ignoring certain log bindings based on a custom function. ```APIDOC type FastifyRequestLoggerOptions = { logBody?: boolean; logBindings?: Record; ignoredPaths?: Array; ignoredBindings?: Record; ignore?: (request: FastifyRequest) => boolean; }; ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.