Permalink
Browse files

Improved the browser example

  • Loading branch information...
balupton committed Dec 12, 2013
1 parent 4718366 commit 79303a01ddc09cf8edff422b1d2a46332ce26526
Showing with 287 additions and 287 deletions.
  1. +6 −6 README.md
  2. +275 −275 example-browser.js
  3. +6 −6 example.js
View
@@ -50,17 +50,17 @@ var level = process.argv.indexOf('-d') === -1 ? 6 : 7;
var logger = require('caterpillar').createLogger({level:level});
var filter = require('caterpillar-filter').createFilter();
var human = require('caterpillar-human').createHuman();
-var browser = require('caterpillar-browser').createBrowser();
// Where to output?
if ( process.title === 'browser' ) {
- // Pipe the filter to human to console.log
- logger.pipe(filter).pipe(human).on('data', function(message){
- console.log(message.toString());
- });
+ // Include the browser compatibility layer
+ var browser = require('caterpillar-browser').createBrowser();
+
+ // Pipe to filter to human to browser
+ logger.pipe(filter).pipe(human).pipe(browser);
}
else {
- // Pipe the filter to human to stdout
+ // Pipe to filter to human to stdout
logger.pipe(filter).pipe(human).pipe(process.stdout);
// If we are debugging, then write the original logger data to debug.log
Oops, something went wrong.

0 comments on commit 79303a0

Please sign in to comment.