/fastify-api-logger

Simple and straightforward API request/response single line data logging for Fastify.

Primary LanguageJavaScriptMIT LicenseMIT

fastify-api-logger

js-standard-style

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

fastify-api-logger

License

Licensed under MIT