summaryrefslogtreecommitdiff
path: root/lib/util.js
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2011-12-14 13:28:51 +0100
committerBen Noordhuis <info@bnoordhuis.nl>2011-12-14 13:36:21 +0100
commit97900776bb3611877d126aa58743eb9b5b2a4be8 (patch)
treecd1598db53572e96db21f14c7978aa204bfc5620 /lib/util.js
parentd29be0dfa2e06ee55ce65e440aba5f36f21d23a2 (diff)
downloadnode-new-97900776bb3611877d126aa58743eb9b5b2a4be8.tar.gz
util: add internal function _deprecationWarning()
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 b00da2de9d..cd4cc0e964 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);
+};