moved debug fn out to own module, added tests

This commit is contained in:
Gareth Jones
2013-06-24 08:51:10 +10:00
parent fc7f686f65
commit 0e5da1d361
6 changed files with 91 additions and 28 deletions

15
lib/debug.js Normal file
View File

@@ -0,0 +1,15 @@
"use strict";
module.exports = function(label) {
var debug;
if (process.env.NODE_DEBUG && /\blog4js\b/.test(process.env.NODE_DEBUG)) {
debug = function(message) {
console.error('LOG4JS: (%s) %s', label, message);
};
} else {
debug = function() { };
}
return debug;
};