问题描述
比如说,在我的 Google Chrome 扩展程序中,我这样做:
Say, in my Google Chrome extension I do this:
console.log(msg);
和 Chrome 调试器将类似的消息分组如下:
and the Chrome debugger groups similar messages like so:
是否有任何方法可以将其关闭并按原样发布消息?
Is there any any to turn it off and have messages post just as they are?
推荐答案
它只会折叠相同的连续行,我认为这不是什么大问题,但是使用右上角的设置按钮控制台您可以启用显示时间戳",这会将它们放在不同的行上:
It only collapses consecutive rows that are identical, I don't see it as much of a problem, but with the settings button in the top right corner of the console you can enable 'Show timestamps' which will put them on different lines:
您可以看到它们只折叠连续的重复项:
You can see they only collapse consecutive duplicates with this:
msgs = ['hello', 'world', 'there'];
for (i = 0; i < 20; i++) console.log(msgs[Math.floor((i/3)%3)])
console api 有许多其他功能可以帮助您遵循代码.例如,console.count(label)
记录标签并记录它被记录的次数,console.group()
允许您将其他日志记录调用组合在一起,console.timeline(label)
可让您将日志分组到时间线中.
The console api has a lot of other functions that might help you follow your code. For instance console.count(label)
logs label with a count of how many times it's been logged, console.group()
lets you group other logging calls together and console.timeline(label)
lets you group logs into a timeline.
这篇关于Chrome 调试器 - 如何关闭 console.log 消息分组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!