koa-logger-winston

Winston logger for Koa


Keywords
logging, koa, winston, async
License
MIT
Install
npm install koa-logger-winston@0.0.2

Documentation

koa-logger-winston

Winston middleware logger for Koa based on express-winston.

Forked from winston-koa-logger to implement ES7 async/await functions for Koa2

Instalation

npm i --save koa-logger-winston

Usage

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);