Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stop Firebug from truncating strings in the console?

While debugging, I frequently dump strings and arrays to the console. But in some cases, Firebug chops up string values, making it hard to be sure of the result.

For example, this code in the console:

console.log ( [
    "123456789A123456789B123456789C123456789D123456789E123456789F123456789G",
    "123456789A123456789B123456789C123456789D123456789E123456789F123456789G"
] );

Yields:

[ "123456789A123456789B123...89E123456789F123456789G",
  "123456789A123456789B123...89E123456789F123456789G"
]

(Bad!)


A single string is okay. This:

console.log ("123456789A123456789B123456789C123456789D123456789E123456789F123456789G");

Yields:

123456789A123456789B123456789C123456789D123456789E123456789F123456789G

as expected.

But, arrays and objects get shortened.
How do I stop this behavior? Is this a bug? (My Google-Fu has failed, so far.)

like image 666
Brock Adams Avatar asked Sep 28 '12 08:09

Brock Adams


2 Answers

Okay, after pawing through the list of Firebug Preferences (there's 204 of those, right now, and not in an apparent order), I found stringCropLength.

It defaults to 50, which makes sense, since the test strings were truncated to 123456789A123456789B123...89E123456789F123456789G, which is 49 characters long.

Opening about:config and setting extensions.firebug.stringCropLength to 0, stopped the strings from being truncated!

Note that according to Issue 5898: Introduce different string cropping preferences, this preference might affect a few things (for now). But, so far, I've seen no ill effects from having this set to no "cropping".

like image 124
Brock Adams Avatar answered Nov 17 '22 00:11

Brock Adams


Use console.dir instead of console.log - the output has a + near it which lets you expand the string.

like image 6
Ariel Avatar answered Nov 17 '22 00:11

Ariel