DevTools Tips

Categories: Supported by:

Format console messages

You can use special formatters in the console.log function to format logs just the way you want.

As a bonus, the %c formatter can also be used to style console messages with CSS properties!

var el = document.body;
console.log('%c There are %d elements in %O', 'color:lime;background:black;', el.childElementCount, el);

Screenshot of a formatted console message in Edge