-
Notifications
You must be signed in to change notification settings - Fork 936
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated example/stdout.js to match debug current behaviour
- Loading branch information
1 parent
05d9fa7
commit 9e61ecb
Showing
1 changed file
with
12 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); |