Lesson 6 / 30
Configuration & Options
Customize Fastify instance behavior with configuration options.
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' } }.