Home > Software engineering >  Find out which console.log() prints the log
Find out which console.log() prints the log

Time:05-30

I am working on a big project with lots of co-workers and while debugging sometimes finding the code that prints terminal logs gets difficult.

So i am looking for a way (or an extension) to find source of the logs from the terminal.

For example i want to right click on the line of the log from the terminal and click 'go to source' and it will bring the file and focus on the line where that log is printed. (I am using VSCode)

Any one have any tricks for this situation?

Thanks.

CodePudding user response:

When you are debugging the project (not just running it in the terminal), you get exactly what you described, in the "Debug Output" tab:

screenshot

See this docs page about how to get node.js debugging with VSCode set up.

CodePudding user response:

I think u can use console.trace() which provides a stack trace.

  • Related