Skip to content

Instantly share code, notes, and snippets.

@camshaft
Created April 27, 2013 16:24
Show Gist options
  • Save camshaft/5473663 to your computer and use it in GitHub Desktop.
Save camshaft/5473663 to your computer and use it in GitHub Desktop.
/**
* Module dependencies
*/
var metric = require('metric-log')
, log = metric.context({fn: "requestLogger"});
log.headers = log.context({at: "headers"}).debug();
log.base = log.context({at: "base"}).debug();
log.body = log.context({at: "body"}).debug();
log.env = log.context({at: "env"}).debug();
/**
* Middleware to log basic parameters about the request.
*/
module.exports = function() {
return function requestLogger(req, res, next) {
log.headers(req.headers);
log.env(process.env);
log.base({ base: req.base });
log.body({ body: req.body });
next();
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment