From df62005ece4bb0be0d5af645fd9093b1506ce63d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Ma=C5=82ecki?= Date: Mon, 16 Jan 2012 13:54:35 +0100 Subject: [PATCH] util: always display a warning for module in debug mode --- lib/util.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/util.js b/lib/util.js index 8cc4739f275..834dc676ee2 100644 --- a/lib/util.js +++ b/lib/util.js @@ -522,15 +522,16 @@ 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)) + if ((new RegExp('\\b' + moduleId + '\\b')).test(process.env.NODE_DEBUG)) { console.trace(message); - else + } else { + if (!deprecationWarnings) { + deprecationWarnings = {}; + } else if (message in deprecationWarnings) { + return; + } console.error(message); + + deprecationWarnings[message] = true; + } };