Lesson 6 / 32
Configuration & Options
Configure the Fastify instance with logger, body limits, request IDs and Pino log levels.
Common options
Set logger, body size limits, request ID generation, and more when creating the Fastify instance.
const fastify = Fastify({
logger: true, // enable logging
bodyLimit: 1048576, // 1MB
disableRequestLogging: false,
trustProxy: true, // if behind a reverse proxy
requestIdLogLabel: 'requestId',
});Logger levels
Use pino (built-in logger) levels: trace, debug, info, warn, error, fatal. Set with { logger: { level: 'debug' } }.