DEV Community

Discussion on: Exploring the Console

Collapse
 
juliyvchirkov profile image
Juliy V. Chirkov • Edited

Thanks a lot, Laura!

I've used to utilize console.dir for years but never even gave a try to console.dirxml 'cause I've mistakenly assumed it's related exactly to xml data trees and with my json data I'm happy enough with console.log and console.dir

But it turned out to be such a cool method! Thanks again for opening my eyes

console.context seems to be an experimental Chrome/V8 feature to let developers to separate debug dataflows and thus make the debugging in DevTools much cleaner, structured, readable and useful

I.e. console.context gonna be the utility to create new Console in custom user context. Like

const Laura = console.context('Laura')
const Juliy = console.context('Juliy')

console.log('default context')
Laura.log('Laura context')
Juliy.log('Juliy context')

This way one is able to review the console output for each of 3 above loggers in DevTools separately, switching between contexts with tabs and filters

Collapse
 
lberge17 profile image
Laura Berge

Thanks Juliy! That's a very helpful explanation of the context method. I'll have to dive into it more! :)