Skip to content

Commit

Permalink
Added debug.log example
Browse files Browse the repository at this point in the history
  • Loading branch information
balupton committed Apr 28, 2013
1 parent 1009a86 commit 1b44a76
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
5 changes: 5 additions & 0 deletions example.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit 1b44a76

Please sign in to comment.