Simple and straightforward API request/response single line data logging for Fastify.
npm install --save fastify-api-logger
const fastify = require('fastify')
fastify.register(require('fastify-api-logger'), {
user: 'userId',
level: 'debug',
prettyPrint: true, // You may want to turn off prettyPrint in production
sensitiveUrls: [], // Ignore sensitive URLs
})
// log format:
// [ip] [user id?] [method] [status code] [path] [response time] [request payload?] [reply payload]
Licensed under MIT