Skip to content

Instantly share code, notes, and snippets.

@purefan
Created September 1, 2014 20:37
Show Gist options
  • Save purefan/21cd90050596f0281aff to your computer and use it in GitHub Desktop.
Save purefan/21cd90050596f0281aff to your computer and use it in GitHub Desktop.
var log=function(){for(var a in arguments)if(0==a){if(-1<arguments[a].indexOf("::")&&(arguments[0]="[ "+arguments[a]+" ]"),arguments[0]!=this.logLastCalled){var b="%c "+Array(20).join(" ")+arguments[a]+Array(40-arguments[a].length).join(" "),c="background: #222;color: #bada55;";-1<arguments[0].indexOf("Error ")&&(b=b.replace("Error ",""),c="background: #222; color: #FF0000;");console.log(b,c)}}else"string"==typeof arguments[a]&&-1<arguments[a].indexOf("Yellow:")?console.log("%c "+arguments[a].replace("Yellow:",""),"background: #222, color: #FFFD40;"):console.log(arguments[a]);this.logLastCalled=arguments[0]};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment