koa-log4js-node
Log4js logger middleware for koa.
Install
npm install koa-log4js-node
Example
var koa = require('koa');
var logger = require('koa-log4js-node');
logger.configure(__dirname + 'log4js.json');
var app = koa();
app.use(logger.info()); // INFO配置 输出所有请求
app.use(function* (){
this.body = "Hello koa-log4js";
});
app.listen(3000,function(err){
logger.error(err);
});
Instrument
- a wrapper for koa middleware
- INFO,ERROR logger