-
Notifications
You must be signed in to change notification settings - Fork 43
Request Logger
Thiago da Rosa de Bustamante edited this page Mar 26, 2018
·
1 revision
A Request Logger is a function that is called to handle requests log entries. This middleware is responsible to save these log entries wherever you need this information.
Each request logger middleware must be defined on its own .js file.
Example:
const fs = require('fs');
module.exports = (requestLog) => {
fs.appendFile('my-log.txt', JSON.stringify(requestLog)+'\n');
};
You can configure an requestMapper middleware through:
- Admin Rest API:
POST /midleware/request/logger
- SDK:
sdk.middleware.addRequestLogger(name, fileName);
- CLI:
treeGatewayConfig middleware requestLogger -a <name> ./filename.js
Tree Gateway provide some request logger middlewares for common tasks already included in its distribution. Check the list here.