Permalink
Browse files

util: always display a warning for module in debug mode

  • Loading branch information...
1 parent 23de339 commit df62005ece4bb0be0d5af645fd9093b1506ce63d @mmalecki mmalecki committed with indutny Jan 16, 2012
Showing with 10 additions and 9 deletions.
  1. +10 −9 lib/util.js
View
@@ -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.