Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Allow for somewhat standard debugging calls #125

Merged
merged 1 commit into from

2 participants

@jimschubert

Rather than commenting out console.log messages or whatever, this would allow for debugging messages in much the same way as node core.

For example:

NODE_DEBUG="http,log4js" node myapp.js

@nomiddlename nomiddlename merged commit 83271e4 into from
@nomiddlename

Cool - thanks for this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 24, 2013
  1. @jimschubert
This page is out of date. Refresh to see the latest.
View
7 lib/streams/BaseRollingFileStream.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;
View
7 lib/streams/DateRollingFileStream.js
@@ -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
8 lib/streams/RollingFileStream.js
@@ -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;
Something went wrong with that request. Please try again.