koa-logger-winston
v0.0.2
Published
Winston logger for Koa
Downloads
5,991
Readme
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);