Does anyone experience this situation where you do
console.info ('hi');
hi // And this hi is printed in black color as opposed to blue
Screenshot from the console:
https://postimg.org/image/g8isebbrn/
console.info was used to print in blue for years! Now to my surprise, not anymore.
I could not find any setting on chrome that makes the output go color-blind like that!
looks like this is indented by design, go figure, but.. here is a way out as an alternative!
console.log("%cThis will be formatted with large, blue text", "color: blue; font-size: x-large");
do NOT forget the %c
in there!
To wrap it in a function, you can use this kick-starter code for you:
function sysConsole(messageType,message){
if ( messageType === 'info') {
s = '%c' + '##' + messageType + ': ' + message;
// the ## will enable you to do filtering at the console
// by typing ##info
console.log (s, 'color: blue;');
}
// you can have other messageTypes later (to be wired for different colors )
return false;
}
for future inspiration, go to https://developers.google.com/web/tools/chrome-devtools/console/console-write
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With