Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
util: always display a warning for module in debug mode
  • Loading branch information
mmalecki authored and indutny committed Jan 16, 2012
1 parent 23de339 commit df62005
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions lib/util.js
Expand Up @@ -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;
}
};

0 comments on commit df62005

Please sign in to comment.