Reputation:
I have over-ridden my console.log to create a log file of everything passed to it. This works great when in dev mode but the log files are empty when in production mode, presumably because console.log doesn't get called?
Anyone know how to enable it so it gets called in production mode?
Thanks
Upvotes: 0
Views: 1584
Reputation: 71
I guess you are trying to print data to the console overview of the Node without using the console function.
process.stdout.write("text" + somevar);
maybe?
Edit:
The function you are asking consists of printing to the console with timestamp. (Aircoded, might fail, but you'll get the concept)
function TSprint(input){
process.stdout.write(Date.getTime() + " |> " + input + "\n");
}
Probably print something like
January 1, 1970, 00:00:00 |> My input.
PS: stdout does not create a new line.
Upvotes: 1