mirror of https://github.com/nodejs/node.git
util: always display a warning for module in debug mode
parent
23de33968f
commit
df62005ece
19
lib/util.js
19
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;
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue