Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can truncated console.log output in Firefox Version 57 be extended?

The recent Version 57 release of the Firefox browser truncates output when console.log(variable) is used in Javascript to write the content of a variable to the F12 developer tools console.

If the value in the variable is long (such as when printing out HTML or a large array), the value is truncated and an ellipsis is shown at the point the value is truncated.

I think earlier versions allowed the user to click on the shown output at the point of truncation to extend it.

However Version 57 does not appear to allow this.

Is there a way in which I can extend the output or display the variable differently?

Sorry if I have missed the obvious here.

like image 966
wurzel_gummidge Avatar asked Nov 18 '17 14:11

wurzel_gummidge


People also ask

How do I use developer console in Firefox?

Opening the Browser Console You can open the Browser Console in one of two ways: from the menu: select “Browser Console” from the Web Developer submenu in the Firefox Menu (or Tools menu if you display the menu bar or are on macOS). from the keyboard: press Ctrl + Shift + J (or Cmd + Shift + J on a Mac).

Where do I find developer tools in Firefox?

Right-click a mouse on any element in the page, and select Inspect from the popup menu. Open the Hamburger menu. and select More tools > Web Developer Tools (Firefox 88 and earlier use the top-level menu Web Developer rather than More tools). Press Ctrl + Shift + I on Windows and Linux, or Cmd + Opt + I on OS X.


2 Answers

I am facing the same problem. It seems that a new bug has recently been introduced to Firefox.

Until the bug is fixed, I have created a hidden <div> and put my log messages in that and view using the Inspector.

like image 82
Rishi Dev Avatar answered Sep 17 '22 13:09

Rishi Dev


I had the same problem; that is a pretty bad mistake on Mozilla's part--

If you are desperate, you can split the string into chunks in an array using regex expression match, then view the array, which will give you access to the rest of the string, like so [make sure the string length isn't a multiple of the n value, 200 here]:

var data = "reallylongstring..."; data.match(/.{1,200}/g);

Firefox should automatically expand the indices out when you click on the array in inspector, so you don't have to click each individual index to see the extended string. This does have the slight perk that it is easy to navigate around the string.

like image 22
Halcyon Avatar answered Sep 21 '22 13:09

Halcyon