Created
April 23, 2015 06:10
-
-
Save nekoneko-wanwan/9ab1f456cdaf85b4c2ac to your computer and use it in GitHub Desktop.
consoleのラッパー
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var debugMode = true; | |
var c; | |
/* 折りたためるようにfunction内に入れている */ | |
(function() { | |
c = { | |
l : (function() { return console.log.bind(console); })(), | |
lc: (function() { return console.log.bind(console, "%c%s", "color:red;font-weight:bold;"); })(), | |
d : (function() { return console.dir.bind(console); })(), | |
t : (function() { return console.table.bind(console); })(), | |
blank: function(){ return; } | |
}; | |
if (!debugMode) { | |
for (var key in c) { | |
c[key] = c.blank; | |
} | |
} | |
})(); | |
//------------------------------------ | |
var hoge = "hoge"; | |
var fuga = ["fuga1", "fuga2", "fuga3"]; | |
var moge = [ | |
{m: "moge1"}, | |
{m: "moge2"}, | |
{m: "moge3"}, | |
{m: "moge4"} | |
]; | |
c.l(hoge); | |
c.lc(hoge); | |
c.d(fuga); | |
c.t(moge); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
console(console.xxx)が効かない環境は考慮していないことに注意