Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*Custom logger
- This was only an experiment.
- I recommend koa-logger npm package
- @phonnz
- */
- var requestTime = function(){
- return function*(next){
- var start = new Date;
- yield next
- if(this.body === 'Not Found') console.log(this.body)
- var ms = new Date - start;
- console.log(this.request.method, this.request.url, ms, 'ms', this.status)
- }
- }
- app.use(requestTime())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement