Commits

Jop de Klein  committed c588668

Added snap.console to allow for customization of error logging

  • Participants
  • Parent commits 9d589f7

Comments (0)

Files changed (3)

File js/snap.iterator.js

                 if (selectedElements.length) {
                     foundElements = foundElements.concat(selectedElements);
                 } else {
-                    console.error('element with selector ' + elements[i].selector + ' was not found');
+                    snap.console.error('element with selector ' + elements[i].selector + ' was not found');
                 }
             }
             
         return true;
     };
     
+    ns.console = window.console || {
+        'warn': function () {},
+        'error': function () {}
+    };
+    
     ns.createSnapshot = function (root) {
         var iterator = snap.iterator({
             'root': root

File js/snap.node.js

         snap.utils.extendSettings(settings, ns.settings, options);
         
         if (settings.styleExcludes.length && settings.styleIncludes.length) {
-            console.warn('Both styleIncludes and styleExcludes are specified, ignoring styleExcludes');
+            snap.console.warn('Both styleIncludes and styleExcludes are specified, ignoring styleExcludes');
             settings.styleExcludes = [];
         }