summaryrefslogtreecommitdiff
path: root/lib/util.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/util.js')
-rw-r--r--lib/util.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/util.js b/lib/util.js
index b00da2de9..cd4cc0e96 100644
--- a/lib/util.js
+++ b/lib/util.js
@@ -518,3 +518,19 @@ exports.inherits = function(ctor, superCtor) {
}
});
};
+
+var deprecationWarnings;
+
+exports._deprecationWarning = function(moduleId, message) {
+ 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
+ console.error(message);
+};