axios-logger-mongo

Mongo logger interceptor for Axios.
Installation
Install using npm:
npm install @yoctol/axios-logger-mongo
API Reference
| mongoURL | String | URL of the mongodb. |
| collectionName | String | Name of the collection. |
| allInstances | Boolean | Support all of axios instances or not. |
| transformRequestBody | Function | Function to map request body. |
| transformResponseBody | Function | Function to map response body. |
Usage
const { useMongoLogger } = require('@yoctol/axios-logger-mongo');
useMongoLogger(axios, {
mongoURL: 'mongodb://localhost:27017/',
collectionName: 'logs',
});
To support all of axios instances, set option allInstances to true:
useMongoLogger(axios, {
mongoURL: 'mongodb://localhost:27017/',
collectionName: 'logs',
allInstances: true,
});