Revert "util: always display a warning for module in debug mode"
authorFedor Indutny <fedor.indutny@gmail.com>
Mon, 16 Jan 2012 13:33:16 +0000 (19:33 +0600)
committerFedor Indutny <fedor.indutny@gmail.com>
Mon, 16 Jan 2012 13:33:16 +0000 (19:33 +0600)
This reverts commit df62005ece4bb0be0d5af645fd9093b1506ce63d.

lib/util.js

index 834dc67..8cc4739 100644 (file)
@@ -522,16 +522,15 @@ exports.inherits = function(ctor, superCtor) {
 var deprecationWarnings;
 
 exports._deprecationWarning = function(moduleId, message) {
-  if ((new RegExp('\\b' + moduleId + '\\b')).test(process.env.NODE_DEBUG)) {
+  if (!deprecationWarnings)
+    deprecationWarnings = {};
+  else if (message in deprecationWarnings)
+    return;
+
+  deprecationWarnings[message] = true;
+
+  if ((new RegExp('\\b' + moduleId + '\\b')).test(process.env.NODE_DEBUG))
     console.trace(message);
-  } else {
-    if (!deprecationWarnings) {
-      deprecationWarnings = {};
-    } else if (message in deprecationWarnings) {
-      return;
-    }
+  else
     console.error(message);
-
-    deprecationWarnings[message] = true;
-  }
 };