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'),
util = require('util');
function debug(message) {
// console.log(message);
var debug;
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;

View File

@ -6,8 +6,11 @@ var BaseRollingFileStream = require('./BaseRollingFileStream'),
module.exports = DateRollingFileStream;
function debug(message) {
// console.log(message);
var debug;
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) {

View File

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