-
Notifications
You must be signed in to change notification settings - Fork 938
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #186 from dmarcelino/181-stderr_stdout
181 stderr vs stdout
- Loading branch information
Showing
3 changed files
with
31 additions
and
31 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
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
var debug = require('../'); | ||
var error = debug('app:error'); | ||
|
||
// by default stderr is used | ||
error('goes to stderr!'); | ||
|
||
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.info | ||
// overrides all per-namespace log settings | ||
debug.log = console.info.bind(console); | ||
error('now goes to stdout via console.info'); | ||
log('still goes to stdout, but via console.info now'); |