简体   繁体   English

在Chrome的开发人员工具控制台中静音脚本

[英]Mute scripts in Chrome's developer tools console

Is it possible to hide all console output from some scripts in Chrome's developer tools? 是否可以隐藏Chrome开发者工具中某些脚本的所有控制台输出? Sometimes third-party libraries or APIs provide some information in console. 有时,第三方库或API在控制台中提供一些信息。 That's OK, but can be very annoying when you want to debug your own code. 没关系,但是当你想调试自己的代码时可能会很烦人。

More simply, can I ask developer tools to hide console output from https://www.google-analytics.com/analytics.js (just dummy example). 更简单的说,我可以要求开发人员工具隐藏https://www.google-analytics.com/analytics.js控制台输出(只是虚拟示例)。 Or even better, to show only error level for this source? 或者甚至更好,只显示此来源的错误级别?

Yes, there are some ways. 是的,有一些方法。 I can add a string marker to text which allows me to filter my messages. 我可以在文本中添加字符串标记,以便我可以过滤我的消息。 I can play around overriding console instance... I wonder if there is such funtionality built in developer tools? 我可以玩覆盖console实例...我想知道开发人员工具中是否有这样的功能?

Accidentally found a part of answer. 无意中发现了答案的一部分。

If you right-click on any message in console, there is Filter item in context menu. 如果右键单击控制台中的任何消息,则在上下文菜单中有“ Filter项。 And you can hide there messages from exact source. 并且您可以隐藏来自确切来源的消息。

Still wonder if there is possibility to set logging level per source. 仍然想知道是否有可能设置每个源的日志记录级别。

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

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