I have a complete, deployed, Express-based project, with many console.log() and console.error() statements throughout. The project runs using forever, directing the st
Create a file with the following:
var log = console.log;
console.log = function(){
log.apply(console, [Date.now()].concat(arguments));
};
Require it in your app before you log anything. Do the same for console.error
if needed.
Note that this solution will destroy variable insertion (console.log("he%s", "y") // "hey"
) if you're using that. If you need that, just log the timestamp first:
log.call(console, Date.now());
log.apply(console, arguments);