Add standard debug conditional function

: master
This commit is contained in:
Jim Schubert 2013-03-23 18:50:13 -07:00
parent 4b7cf589a2
commit f3271a3997
3 changed files with 15 additions and 7 deletions

View File

@ -2,8 +2,11 @@ var fs = require('fs'),
stream = require('stream'), stream = require('stream'),
util = require('util'); util = require('util');
function debug(message) { var debug;
// console.log(message); if (process.env.NODE_DEBUG && /\blog4js\b/.test(process.env.NODE_DEBUG)) {
debug = function(message) { console.error('LOG4JS: (BaseRollingFileStream) %s', message); };
} else {
debug = function() { };
} }
module.exports = BaseRollingFileStream; module.exports = BaseRollingFileStream;

View File

@ -6,8 +6,11 @@ var BaseRollingFileStream = require('./BaseRollingFileStream'),
module.exports = DateRollingFileStream; module.exports = DateRollingFileStream;
function debug(message) { var debug;
// console.log(message); if (process.env.NODE_DEBUG && /\blog4js\b/.test(process.env.NODE_DEBUG)) {
debug = function(message) { console.error('LOG4JS: (DateRollingFileStream) %s', message); };
} else {
debug = function() { };
} }
function DateRollingFileStream(filename, pattern, options, now) { function DateRollingFileStream(filename, pattern, options, now) {

View File

@ -4,9 +4,11 @@ var BaseRollingFileStream = require('./BaseRollingFileStream'),
fs = require('fs'), fs = require('fs'),
async = require('async'); async = require('async');
function debug() { var debug;
// util.debug(message); if (process.env.NODE_DEBUG && /\blog4js\b/.test(process.env.NODE_DEBUG)) {
// console.log.apply(console, arguments); debug = function(message) { console.error('LOG4JS: (RollingFileStream) %s', message); };
} else {
debug = function() { };
} }
module.exports = RollingFileStream; module.exports = RollingFileStream;