Skip to content

Commit

Permalink
Updated example/stdout.js to match debug current behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
dmarcelino committed Mar 13, 2015
1 parent 05d9fa7 commit 9e61ecb
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions example/stdout.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
var debug = require('../');
var log = debug('app:log');
var error = debug('app:error');

// by default console.log is used
log('goes to stdout!');
// by default stderr is used
error('goes to stderr!');

var error = debug('app:error');
// set this namespace to log via console.error
error.log = console.error.bind(console); // don't forget to bind to console!
error('goes to stderr');
log('still goes to stdout!');
var log = debug('app:log');
// set this namespace to log via console.log
log.log = console.log.bind(console); // don't forget to bind to console!
log('goes to stdout');
error('still goes to stderr!');

// set all output to go via console.warn
// set all output to go via console.info
// overrides all per-namespace log settings
debug.log = console.warn.bind(console);
log('now goes to stderr via console.warn');
error('still goes to stderr, but via console.warn now');
debug.log = console.info.bind(console);
error('now goes to stdout via console.info');
log('still goes to stdout, but via console.info now');

0 comments on commit 9e61ecb

Please sign in to comment.