Skip to content

Instantly share code, notes, and snippets.

@nikhilw
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nikhilw/aebc424aa7b74b58a3d2 to your computer and use it in GitHub Desktop.
Save nikhilw/aebc424aa7b74b58a3d2 to your computer and use it in GitHub Desktop.
Reuse a built-in logging format for Node/Express/Morgan
logger.format("mine", function(tokens, req, res) {
var dt = new Date;
// Key being: all the logging format added internally are available directly as methods: .dev/.default/.full etc
return "" + dt.getDate() + dt.getMonth() + dt.getYear() +"_"+ dt.getHours() + dt.getMinutes() + dt.getSeconds() + " : " + logger.dev(tokens, req, res);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment