Skip to content

Instantly share code, notes, and snippets.

@alloy-d
Created February 4, 2013 22:23
Show Gist options
  • Save alloy-d/4710272 to your computer and use it in GitHub Desktop.
Save alloy-d/4710272 to your computer and use it in GitHub Desktop.
IE MAKES LOGGING IN JAVASCRIPT SO FUN.
define(function () {
var exports = {};
funcs = ["log", "warn", "error", "group", "groupEnd"];
for (var i in funcs) {
exports[funcs[i]] = (function (func) {
return function () {
if (typeof(console) !== "undefined" && funcs[i] in console) {
console[func].apply(console, arguments);
}
};
}(funcs[i]));
}
return exports;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment