X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/d798a69cb177ba4dabd2d917e1da6ab94707aa7d..653c75b6951e028fe4c68e27cc9852e45fa418a6:/project/static/js/jquery.logging.js?ds=sidebyside diff --git a/project/static/js/jquery.logging.js b/project/static/js/jquery.logging.js index 315d48f5..d6cee14d 100644 --- a/project/static/js/jquery.logging.js +++ b/project/static/js/jquery.logging.js @@ -3,35 +3,39 @@ var LEVEL_INFO = 2; var LEVEL_WARN = 3; var LOG_LEVEL = LEVEL_DEBUG; - - var mozillaLog = function() { - if (window.console) - console.log.apply(this, arguments); - }; - - var safariLog = function() { - if (window.console) - console.log.apply(console, arguments); - }; + + var standardLog = function() { + if (window.console) + console.log.apply(console, arguments); + }; var operaLog = function() { opera.postError(arguments.join(' ')); }; - var defaultLog = function() { return false; }; + var msieLog = function() { + var args = $.makeArray(arguments); + var vals = $.map(args, function(n) { + try { + return JSON.stringify(n); + } catch(e) { + return ('' + n); + } + }); - $.log = function( ) { + if (window.console) + console.log(vals.join(" ")); + }; + + $.log = function() { return $.log.browserLog.apply(this, arguments); }; - if ($.browser.mozilla) - $.log.browserLog = mozillaLog; - else if ($.browser.safari) - $.log.browserLog = safariLog; - else if($.browser.opera) - $.log.browserLog = operaLog; - else - $.log.browserLog = defaultLog; - + if($.browser.opera) + $.log.browserLog = operaLog; + else if($.browser.msie) + $.log.browserLog = msieLog; + else + $.log.browserLog = standardLog; })(jQuery);