diff options
author | Soreine <nicolas@gitbook.com> | 2016-04-27 14:52:26 +0200 |
---|---|---|
committer | Soreine <nicolas@gitbook.com> | 2016-04-27 14:52:26 +0200 |
commit | 503cc4a7297cdba2a3d6310c030a894603105f2e (patch) | |
tree | 549488f431a51a38c8b052951541afede95a2f88 /lib/utils | |
parent | d585269228393a398cce6dae66d1ab63ea1d5d9b (diff) | |
download | gitbook-503cc4a7297cdba2a3d6310c030a894603105f2e.zip gitbook-503cc4a7297cdba2a3d6310c030a894603105f2e.tar.gz gitbook-503cc4a7297cdba2a3d6310c030a894603105f2e.tar.bz2 |
Check for stdout, for browser compatibility
Diffstat (limited to 'lib/utils')
-rw-r--r-- | lib/utils/logger.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/utils/logger.js b/lib/utils/logger.js index a913709..fc9c394 100644 --- a/lib/utils/logger.js +++ b/lib/utils/logger.js @@ -20,7 +20,11 @@ var COLORS = { function Logger(write, logLevel) { if (!(this instanceof Logger)) return new Logger(write, logLevel); - this._write = write || function(msg) { process.stdout.write(msg); }; + this._write = write || function(msg) { + if(process.stdout) { + process.stdout.write(msg); + } + }; this.lastChar = '\n'; this.setLevel(logLevel || 'info'); |