Zmiana nazwy project -> platforma.
[redakcja.git] / 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 (file)
index 0000000..d6cee14
--- /dev/null
@@ -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);