Google has not been helpful for me, since searching for "console.debug" just brings up a bunch of pages that have the words "console" and "debug" on them.
I'm wondering what the difference is between console.log()
and console.debug()
. Is there some way to use a bunch of console.debug()
statements and then just flip a switch to easily shut off all debug statements from being sent to the console (like after launching a site)?
Technically
console.log
console.debug
andconsole.info
are identical However the way they display the data is little differentconsole.log
Black color text with no iconconsole.info
Blue color text with iconconsole.debug
Pure black color textconsole.warn
Yellow color text with iconconsole.error
Red Color text with iconFrom Documentation of browsers,The
log
,debug
and alsoinfo
methods are identical in implementation wise but varies in color and iconhttps://jsfiddle.net/yp4z76gg/1/
console.info
,console.debug
methods are identical toconsole.log
.console.log
Printing statementconsole.info
Black color text with "i" icon in blue colorconsole.debug
Blue Color textDocumentation:
For at least IE, Firefox and Chrome consoles, .debug() is just an alias for .log() added for improved compatibility
https://developer.mozilla.org/en-US/docs/Web/API/console
https://developers.google.com/chrome-developer-tools/docs/console-api#consoledebugobject_object
https://msdn.microsoft.com/en-us/library/ie/hh772183(v=vs.85).aspx
If you want the ability to disable logging after a product is finished you could override the
console.debug()
function or make another custom one.However I havent figured a way to color the outputs as well.
they are identical except for 1 thing - debug messages are hidden by default in recent versions of Chrome (you have to set log level to
Verbose
on top of console to see debug messages; you see log messages by default).