@random-guys/express-bunyan
v0.2.0
Published
Wrapper around axios for interservice communication
Downloads
6
Readme
express-bunyan
Express middleware for logging Request
s
Included in the package:
- UUIDs for each request
- Request serializer
- Helpers for logging request and responses
How to install?
yarn add @random-guys/express-bunyan
How does it work?
const logger = createLogger({
name: 'some_name',
serializers: {
// ...other serializers
req: createRequestSerializer('password', 'dob')
}
})
// log all incoming requests
app.use(logRequests(logger))
app.get('/request-watcher', (req, res) => {
// each request gets a UUID
console.log('New request with', req.id)
// use log helpers
logResponse(logger, req, res)
// ....
})
TODO
[ ] Improve coverage of tests