fastify-api-logger
v1.0.10
Published
Simple and straightforward API request/response single line data logging for Fastify
Downloads
15
Readme
fastify-api-logger
Simple and straightforward API request/response single line data logging for Fastify.
Install
npm install --save fastify-api-logger
Usage
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]
Demo
License
Licensed under MIT