      1 /** Console X
      2 * http://github.com/deadlyicon/consolex.js
      3 *
      4 * By Jared Grippe <jared@jaredgrippe.com>
      5 *
      6 * Copyright (c) 2009 Jared Grippe
      7 * Licensed under the MIT license.
      8 *
      9 * consolex avoids ever having to see javascript bugs in browsers that do not implement the entire
     10 * firebug console suit
     11 *
     12 */
     13 (function(window) {
     14   window.console || (window.console = {});
     15
     16   var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
     17   "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
     18
     19   function emptyFunction(){}
     20
     21   for (var i = 0; i < names.length; ++i){
     22     window.console[names[i]] || (window.console[names[i]] = emptyFunction);
     23     if (typeof window.console[names[i]] !== 'function')
     24       window.console[names[i]] = (function(method) {
     25           return function(){ return Function.prototype.apply.apply(method, [console,arguments]); };
     26         })(window.console[names[i]]);
     27   }
     28 })(this);