koa-bunyan-request-logger
Koa middleware that decorates the context object with a bunyan logger.
Usage
const Koa = require('koa');
const logMiddleware = require('@nthlytics/koa-bunyan-request-logger');
const app = Koa();
app.use(logMiddleware('Request Logger'));
app.use(async (ctx, next) => {
// ctx.state.logger is a bunyan logger with the name 'Request Logger'
// and a req_id property that has the value of the x-request-id header.
ctx.state.logger.info('Made it this far');
await next();
});