Check for stdout, for browser compatibility

This commit is contained in:
Soreine
2016-04-27 14:52:26 +02:00
parent d585269228
commit 503cc4a729
+5 -1
View File
@@ -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');