koa-logs

2.0.9 • Public • Published

koa-logs

Build Status Coverage Status License npm Version

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

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i koa-logs

Weekly Downloads

1

Version

2.0.9

License

MIT

Last publish

Collaborators

  • hardog