Winston middleware logger for Koa based on
express-winston
.
Forked from winston-koa-logger to implement ES7 async/await functions for Koa2
npm i --save koa-logger-winston
You need to pass a instance of winston to middleware.
const Koa = require('koa');
const logger = require('./logger'); // Winston instance.
const koaLogger = require('koa-logger-winston');
const app = new Koa();
app.use(koaLogger(logger));
app.use(async (ctx, next) => {
await next();
ctx.body = 'Hello World';
});
app.listen(3000);