util: always display a warning for module in debug mode

v0.7.4-release
Maciej Małecki 2012-01-16 13:54:35 +01:00 committed by Fedor Indutny
parent 23de33968f
commit df62005ece
1 changed files with 10 additions and 9 deletions

View File

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