diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2011-12-14 13:28:51 +0100 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2011-12-14 13:36:21 +0100 |
commit | 97900776bb3611877d126aa58743eb9b5b2a4be8 (patch) | |
tree | cd1598db53572e96db21f14c7978aa204bfc5620 /lib/util.js | |
parent | d29be0dfa2e06ee55ce65e440aba5f36f21d23a2 (diff) | |
download | node-new-97900776bb3611877d126aa58743eb9b5b2a4be8.tar.gz |
util: add internal function _deprecationWarning()
Diffstat (limited to 'lib/util.js')
-rw-r--r-- | lib/util.js | 16 |
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); +}; |