From 503cc4a7297cdba2a3d6310c030a894603105f2e Mon Sep 17 00:00:00 2001 From: Soreine Date: Wed, 27 Apr 2016 14:52:26 +0200 Subject: [PATCH] Check for stdout, for browser compatibility --- lib/utils/logger.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/utils/logger.js b/lib/utils/logger.js index a91370932..fc9c39454 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');