Skip to content

Instantly share code, notes, and snippets.

@WebRTCGame
Created October 30, 2014 14:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WebRTCGame/6ed9651f586438dc5b96 to your computer and use it in GitHub Desktop.
Save WebRTCGame/6ed9651f586438dc5b96 to your computer and use it in GitHub Desktop.
Colored console output
console.__proto__.__proto__.fLog = (function () {
var severityColor = function (severity) {
switch (severity) {
case 1:
return 'green';
break;
case 2:
return 'blue';
break;
case 3:
return 'yellow';
break;
case 4:
return 'orange';
break;
case 5:
return 'red';
break;
default:
return 'white';
}
};
return function (message, severity) {
var theCSS = 'background: ' + severityColor(severity) + '; color: white; font: 20px/40px arial; padding: 2px 10px; text-shadow: 1px 1px 2px black, 1px -1px 2px black, -1px 1px 2px black, -1px -1px 2px black;';
console.log('%c' + message, theCSS);
};
}());
console.fLog("important", 3);
console.fLog("important", 5);
console.fLog("asdfasdf", 2);
var exampleFunction = function () {
console.group();
console.fLog("the message", 1);
console.trace();
console.groupEnd();
};
exampleFunction();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment