Google Chrome开发人员工具控制台记录...几乎没用? [英] Google Chrome developer tools console logging... almost useless?

查看:190
本文介绍了Google Chrome开发人员工具控制台记录...几乎没用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找无处不在试图找到一种方法来修改开发人员工具控制台登录Google Chrome的行为。我来了。

I've been looking everywhere trying to find a way to modify the behavior of the developer tools console logging in Google Chrome. I've come up short.

控制台默认情况下不会显示每次记录。它似乎保持同一消息发送到日志的次数的计数。在您记录项目以验证或调试Web应用程序中的工作流程时,这不会有帮助。

The console, by default, does not show each and every time logged. It appears to be keeping a tally of the number of times that the same message is sent to the log. This does not help when you are logging items to verify or debug workflow in a web application.

如果我要记录:


1
2
1
1
2
3

我希望看到这些,但是你得到的更像:

I expect to see just that, but what you get is more like:


(3) 1
(2) 2
    3

是否有任何方法可以更改此行为并强制控制台显示

Is there any way to change this behavior and force the console to show you each and every item that has been logged?

谢谢你,

JDF

推荐答案

好吧,我似乎找到了一个相当不错的工作...我修改我的日志功能如下:

Well, I appear to have found a decent enough work around... I modified my logging function to the following:

function WriteToLog(msg, clear) {
    try {
        var now = new Date();
        if (clear) {
            console.clear();
        }
        console.log('(' + now.getTime() + ') - ' + msg);
    } catch (e) {

    }
}

这将获得自1970年1月1日以来的毫秒数...这应该是足够清楚的记录在任何计算机上我将拥有的任何进程在不久的将来。 :)

This will get the number of milliseconds since 1/1/1970... Which should be distinct enough for logging any process on any computer I will own in the near future. :)

它使日志更难读,并且这个值几乎没有用处...但是它足以区分默认的提示行为。

It makes the logs a little more difficult to read, and the value is pretty much useless... but it is distinct enough to circumvent the default tally behavior.

感谢您的关注。我希望我不是唯一一个严重不喜欢这个功能的人。

Thanks for looking. I hope I'm not the only one who seriously dislikes this feature.

这篇关于Google Chrome开发人员工具控制台记录...几乎没用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆