Lets say that we have some
console.log in our code, some of them are related to contact form other are related to user actions. We can split those logs into 2 sections:
user-actions. When we open our website, console displays all of those messages at once but we only want to debug user actions so what do we do? – remove console.log in contact form section? nope, there’s better option – grouped logging.
At first lets write down all section names and create a var that will hold only those we want to debug:
Looks good, this way we won’t have to look for the names of groups. Now we only have to create a function that will group logs, here’s a code for it:
Here’s how to use it:
That’s all folks, thanks for reading!