Chrome console devtools: see toString object view?

After crashing Firefox (FireBug) for the 30th time during debugging (I'm on Ubuntu), I decided to use Chrome. For the most part, this is great. I have only one big problem. In FireBug, when you wrote something to the console, you always get a string representation of the object. As a result, it was wise to implement toString on most of your prototypes, allowing you to display the most important information at any time when the object appeared anywhere in the developer’s or console panels.

If my code registers the following:

console.log(bill_gates); 

I do not want the first view of my object in the console to be as follows:

 Object 

when it's possible:

 Person{Bill Gates, Microsoft Founder, dob: Oct 28} 

And I don’t have to write everything down twice to make up for this flaw:

 console.log(bill_gates, bill_gates.toString()); 

In addition, double-logging does not help when you navigate to an object and find that your object consists of other objects, all of which are marked as “Object”.

Imagine going to a party where each name icon says “Man.” I want a little more about this person, perhaps Ned Campbell, Realtor or Sue Bradshaw, Insurance Sales. In FireBug, your objects carry custom name icons (based on your implementation of toString). In Chrome, all of your objects carry name badges that say “Object.” You must spend time interrogating the object (drilling its properties and methods) to find out which object you are dealing with. What a waste.

This is for me the main control over the design of the great Chrome Devtools. Is there a way (possibly an extension) for Devtools to display string representations of objects (wherever they appear) like FireBug?

+6
source share
2 answers

Regarding the second part of your question: yes, there is a bug filed against the Web Inspector (in WebKit bugzilla.) Feel free of charge for yourself on it (as soon as you registered there).

+1
source

In the Eclipse debugger for Chrome from ChromeDevTools for Java , you have a toString() view (in all views of variables / expressions).

However, you do not have access to the console tree or the DOM, only for JavaScript code.

0
source

Source: https://habr.com/ru/post/907656/


All Articles