Hapi plugin to log errors on requests
npm install @softonic/hapi-error-loggerHapi plugin to log errors on requests
``bash`
npm install @softonic/hapi-error-logger
`js
// CommonJS
// const HapiErrorLogger = require('@softonic/hapi-error-logger');
// ES2016
import HapiErrorLogger from '@softonic/hapi-error-logger';
await server.register({
plugin: HapiErrorLogger,
options: {
logger: bunyan.createLogger({ name: 'myapp' }),
// whitelistHeaders and blacklistHeaders should not be used together
whitelistRequestHeaders: ['host', 'accept', 'content-type'],
blacklistRequestHeaders: ['authorization'],
isLoggableRequestError: error => error.output.statusCode >= 500
}
});
`
Clone the repository and execute:
`bash`
npm test
1. Fork it: git clone https://github.com/softonic/@softonic/hapi-error-logger.gitgit checkout -b feature/my-new-feature
2. Create your feature branch: git commit -am 'Added some feature'
3. Commit your changes: npm run build
4. Check the build: git push origin my-new-feature`
4. Push to the branch:
5. Submit a pull request :D