Permalink
Browse files

Merge pull request #125 from jimschubert/master

Allow for somewhat standard debugging calls
  • Loading branch information...
2 parents 4b7cf58 + f3271a3 commit 83271e47fc3d290d38e91972f998f99c918928d6 Gareth Jones committed Mar 25, 2013
Showing with 15 additions and 7 deletions.
  1. +5 −2 lib/streams/BaseRollingFileStream.js
  2. +5 −2 lib/streams/DateRollingFileStream.js
  3. +5 −3 lib/streams/RollingFileStream.js
@@ -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;
@@ -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) {
@@ -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;

0 comments on commit 83271e4

Please sign in to comment.