I have another question (last question). At the moment i am working on a Node.js project and in this I have many console.log() functions. This has worked ok
Just write your own log function:
function log(message) { console.log(message); fs.writeFileSync(...); }
Then replace all your existing calls to console.log() with log().
console.log()
log()