koa-logs
v2.0.9
Published
a middleware for koa requset log
Downloads
6
Readme
koa-logs
a simple middleware for record koa logs!
Features
- support logs type(process.stdout, stream, console)
- suport kinds of type(
tiny
, WTODO More)
Usage
use default output console.log
let app = koa();
app.use(log());
app.listen(3000);
use output process.stdout
let app = koa();
app.use(log('tiny', {
handle: process.stdout
}));
app.listen(3000);
use output fs.createWriteStream
let app = koa();
app.use(log('tiny', {
handle: fs.createWriteStream(path)
}));
app.listen(3000);
use skip
let app = koa();
app.use(log('tiny', {
handle: fs.createWriteStream(path),
skip: function(ctx){
if(ctx.url === '/ignore'){
return true;
}else{
return false;
}
}
}
}));
app.listen(3000);
Install
$ npm install koa-logs -g
Test
$ npm test
$ npm run cover
$ npm run lint