How do I disable firefox console from grouping dup

2019-01-25 03:56发布

Anyone knows how to avoid firefox console to group log entries?

I have seen how to do it with firebug https://superuser.com/questions/645691/does-firebug-not-always-duplicate-repeated-identical-console-logs/646009#646009 but i haven't found any group log entry in about:config section.

I don't want use Firebug, because it's no longer supported or maintained and i really like firefox console.

I try to explain better, i want console to print all logs and not the red badge with number of occurences of one log string:

enter image description here

In the above picture i would like to have two rows of the first log row, two rows of the second and three of the third.

Is this possible?

Thanks in advance

4条回答
一夜七次
2楼-- · 2019-01-25 04:12

As I mentioned in comment section, There is no way to achieve this at the moment. maybe you should try to request this feature via Bugzilla@Mozilla

Also you can check Gaps between Firebug and the Firefox DevTools

查看更多
\"骚年 ilove
3楼-- · 2019-01-25 04:16

Although you still cannot do this (as of August of 2018), I have a work-around that may or may not be to your liking.

You have to display something different/unique to a line in the console to avoid the little number and get an individual line.

I am debugging some JavaScript.

I was getting "Return false" with the little blue 3 in the console indicating three false results in a row. (I was not displaying the "true" results.)

I wanted to see all of the three "false" messages in case I was going to do a lot more testing.

I found that, if I inserted another console.log statement that displays something different each time (in my case, I just displayed the input data since it was relatively short), then I would get separate lines for each "Return false" instead of one with the little 3.

So, in the code below, if you uncomment this: "console.log(data);", you will get the data, followed by " Return false" instead of just "false" once with the little 3.

Another option, if you don't want the extra line in the console, is to include both statements in one: "console.log("Return false -- " + data);"

function(data){

   ...more code here...

    // console.log(data);
    console.log("Return false ");
    return false;
}

threeWords("Hello World hello"); //== True
threeWords("He is 123 man"); //== False
threeWords("1 2 3 4"); //== False
threeWords("bla bla bla bla"); //== True
threeWords("Hi"); // == False
查看更多
做自己的国王
4楼-- · 2019-01-25 04:25

As a workaround you can append a Math.random() to the log string. That should make all your output messages unique, which would cause them all to be printed. For example:

console.log(yourvariable+" "+Math.random());

查看更多
我欲成王,谁敢阻挡
5楼-- · 2019-01-25 04:30

To solve this for any browser, you could use this workaround: Override the console.log command in window to make every subsequent line distinct from the previous line.

This includes toggling between prepending an invisible zero-width whitespace, prepending a timestamp, prepending a linenumber. See below for a few examples:

(function()
{
    var prefixconsole = function(key, fnc)
    {
        var c = window.console[key], i = 0;
        window.console[key] = function(str){c.call(window.console, fnc(i++) + str);};
    };

    // zero padding for linenumber
    var pad = function(s, n, c){s=s+'';while(s.length<n){s=c+s;}return s;};

    // just choose any of these, or make your own:
    var whitespace = function(i){return i%2 ? '\u200B' : ''};
    var linenumber = function(i){return pad(i, 6, '0') + ' ';};
    var timestamp = function(){return new Date().toISOString() + ' ';};

    // apply custom console (maybe also add warn, error, info)
    prefixconsole('log', whitespace); // or linenumber, timestamp, etc
})();

Be careful when you copy a log message with a zero-width whitespace.

查看更多
登录 后发表回答