I got log entries like this, probably the result of a console.log
somewhere. How do I figure out which source file it's from?
Asked
Active
Viewed 200 times
-1

Harry
- 52,711
- 71
- 177
- 261
-
2I don't think it's possible to say from the log alone. You either need to look for all code that logs stuff or do some modification (likely - overwrite the logging function with slightly custom logic) and then look at the new log later on. – VLAZ Jan 04 '20 at 21:29
-
@VLAZ was hoping that there was a npm module that does that custom logging already? – Harry Jan 04 '20 at 22:02
-
1There probably is but I think you'd also need to change all `console.log`s to `whatevermodule.log` calls. I am not sure there is a module that just overrides the default logging, although there might be. [I've written before about overwriting logging](https://stackoverflow.com/questions/39634926/how-to-disable-console-log-messages-based-on-criteria-from-specific-javascript-s/) and I think parts of this might be of use to you. I'll try to do some research for Node specifically and post an answer here, if I find anything useful. – VLAZ Jan 04 '20 at 22:04
-
@VLAZ found the answer here. Thanks for your help. https://stackoverflow.com/questions/45395369/how-to-get-console-log-line-numbers-shown-in-nodejs – Harry Jan 05 '20 at 01:46
-
1@VLAZ ahh this is what I wanted: https://www.npmjs.com/package/debug-trace – Harry Jan 05 '20 at 01:57