X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/7f3f79476a57d10991566c511d40e20154c01064..78644811ca0c6042212788dc67add42bc41fb74c:/platforma/static/js/lib/jquery.logging.js diff --git a/platforma/static/js/lib/jquery.logging.js b/platforma/static/js/lib/jquery.logging.js new file mode 100644 index 00000000..d6cee14d --- /dev/null +++ b/platforma/static/js/lib/jquery.logging.js @@ -0,0 +1,41 @@ +(function($) { + var LEVEL_DEBUG = 1; + var LEVEL_INFO = 2; + var LEVEL_WARN = 3; + var LOG_LEVEL = LEVEL_DEBUG; + + var standardLog = function() { + if (window.console) + console.log.apply(console, arguments); + }; + + var operaLog = function() { + opera.postError(arguments.join(' ')); + }; + + var msieLog = function() { + var args = $.makeArray(arguments); + var vals = $.map(args, function(n) { + try { + return JSON.stringify(n); + } catch(e) { + return ('' + n); + } + }); + + if (window.console) + console.log(vals.join(" ")); + }; + + $.log = function() { + return $.log.browserLog.apply(this, arguments); + }; + + if($.browser.opera) + $.log.browserLog = operaLog; + else if($.browser.msie) + $.log.browserLog = msieLog; + else + $.log.browserLog = standardLog; + +})(jQuery);