JavaScript: console — debugging output

How to display trace code in JavaScript?

I came across code using “alert”, but I found it annoying, that I have to confirm every single message.

console.log(…) and console.debug(…) instead do not work like that. But I found that the output of console.log(…) resp. console.debug(…) appear quite a little delayed. I wondered why that is so.

Because the software I am working on already creates tons of lines in the console window, I need to make my output stand out a little, “%c” is good for that:

console.debug("%c=%s: %s=>{%s} // %snnn","color:green; background-color:yellow",proc_name, ...);

Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.