Node.js util log()

Description

Node.js util log()



var util=  require('util');

//a simple logging middleware;
function logit(req,res,next){
    util.log(util.format('Request received: %s, %s',req.method,req.url));
    next();/*from www  .j  av a2  s. c  o  m*/
}

var connect = require('connect');

connect().use(logit).listen(3000);



PreviousNext

Related