https://github.com/softonic/hapi-error-logger
Hapi plugin to log errors on requests
https://github.com/softonic/hapi-error-logger
Last synced: about 1 year ago
JSON representation
Hapi plugin to log errors on requests
- Host: GitHub
- URL: https://github.com/softonic/hapi-error-logger
- Owner: softonic
- License: other
- Created: 2017-03-17T16:06:36.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2023-03-03T12:33:35.000Z (over 3 years ago)
- Last Synced: 2024-04-14T11:16:42.211Z (about 2 years ago)
- Language: JavaScript
- Size: 1.88 MB
- Stars: 0
- Watchers: 21
- Forks: 0
- Open Issues: 21
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @softonic/hapi-error-logger
Hapi plugin to log errors on requests
## Installation
```bash
npm install @softonic/hapi-error-logger
```
## Usage
```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
}
});
```
## Testing
Clone the repository and execute:
```bash
npm test
```
## Contribute
1. Fork it: `git clone https://github.com/softonic/@softonic/hapi-error-logger.git`
2. Create your feature branch: `git checkout -b feature/my-new-feature`
3. Commit your changes: `git commit -am 'Added some feature'`
4. Check the build: `npm run build`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request :D