How to group console.logs – Advanced JavaScript Logging Using console.group()
Posted on August 3, 2015 | Comments Off on How to group console.logs – Advanced JavaScript Logging Using console.group()
You can group related log statements by surrounding them with the console.group() and console.groupEnd() functions:
All log statements issued in between will be displayed as a group in the console view.
console.group("URL Details"); console.log("Scheme: HTTPS") console.log("Host: example.com"); console.groupEnd();
Collapsing and Nesting Logging Groups
Note that the groups created by console.group() are initially opened. If you’d rather have them collapsed by default, you can call the console.groupCollapsed() instead: