I am working on a game using NodeJs, and realized it would be immensly helpful to have access to old console.log
output. The mechanics and calculations get rather complicated, and it would be nice to have access to them later to search through and do some data analysis on them to find the correct values for my modifiers (battle mechanics). At the same time, I want to see console.log
in the console as well.
I know this isn't possible with regular javascript, (see This), but I was hoping npm had a package of some way to intercept logs and log them to a file on the server. Any thoughts?
You can intercept console.log like so
var cl = console.log
console.log = function(...args){
// your custom logging logic here
cl.apply(console, args)
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With