@softonic/hapi-error-logger
v4.0.0
Published
Hapi plugin to log errors on requests
Downloads
236
Maintainers
Readme
@softonic/hapi-error-logger
Hapi plugin to log errors on requests
Installation
npm install @softonic/hapi-error-logger
Usage
// 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
}
});
Testing
Clone the repository and execute:
npm test
Contribute
- Fork it:
git clone https://github.com/softonic/@softonic/hapi-error-logger.git
- Create your feature branch:
git checkout -b feature/my-new-feature
- Commit your changes:
git commit -am 'Added some feature'
- Check the build:
npm run build
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D