Permalink
Browse files

Added debug.log example

  • Loading branch information...
1 parent 1009a86 commit 1b44a769d8e4371983b3a193e3f51f13eaff3789 @balupton balupton committed Apr 28, 2013
Showing with 10 additions and 0 deletions.
  1. +5 −0 README.md
  2. +5 −0 example.js
View
@@ -35,6 +35,11 @@ var human = new (require('caterpillar-human').Human)();
// Pipe logger output to filter, then filter output to stdout
logger.pipe(filter).pipe(human).pipe(process.stdout);
+// If we are debugging, then write the original logger data to debug.log
+if ( level === 7 ) {
+ logger.pipe(require('fs').createWriteStream('./debug.log'));
+}
+
// Log messages
logger.log('emergency', 'this is level 0');
logger.log('emerg', 'this is level 0');
View
@@ -7,6 +7,11 @@ var human = new (require('caterpillar-human').Human)();
// Pipe logger output to filter, then filter output to stdout
logger.pipe(filter).pipe(human).pipe(process.stdout);
+// If we are debugging, then write the original logger data to debug.log
+if ( level === 7 ) {
+ logger.pipe(require('fs').createWriteStream('./debug.log'));
+}
+
// Log messages
logger.log('emergency', 'this is level 0');
logger.log('emerg', 'this is level 0');

0 comments on commit 1b44a76

Please sign in to comment.