简体   繁体   English

找出哪个 console.log() 打印日志

[英]Find out which console.log() prints the log

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.谢谢。

我认为您可以使用提供堆栈跟踪的console.trace()

When you are debugging the project (not just running it in the terminal), you get exactly what you described, in the "Debug Output" tab:当您调试项目(不仅仅是在终端中运行它)时,您会在“调试输出”选项卡中得到您所描述的内容:

截屏

See this docs page about how to get node.js debugging with VSCode set up.请参阅此文档页面,了解如何使用 VSCode 设置进行 node.js 调试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM