fix console log for undefined params

This commit is contained in:
Iuri Matias 2018-07-08 23:40:32 +03:00
parent 2c478e26ff
commit 0af55a4f5d

View File

@ -24,7 +24,7 @@ Logger.prototype.error = function () {
return; return;
} }
this.events.emit("log", "error", ...arguments); this.events.emit("log", "error", ...arguments);
this.logFunction(...Array.from(arguments).map(t => t.red)); this.logFunction(...Array.from(arguments).map(t => t ? t.red : t));
this.writeToFile("[error]: ", ...arguments); this.writeToFile("[error]: ", ...arguments);
}; };
@ -33,7 +33,7 @@ Logger.prototype.warn = function () {
return; return;
} }
this.events.emit("log", "warning", ...arguments); this.events.emit("log", "warning", ...arguments);
this.logFunction(...Array.from(arguments).map(t => t.yellow)); this.logFunction(...Array.from(arguments).map(t => t ? t.yellow : t));
this.writeToFile("[warning]: ", ...arguments); this.writeToFile("[warning]: ", ...arguments);
}; };
@ -42,7 +42,7 @@ Logger.prototype.info = function () {
return; return;
} }
this.events.emit("log", "info", ...arguments); this.events.emit("log", "info", ...arguments);
this.logFunction(...Array.from(arguments).map(t => t.green)); this.logFunction(...Array.from(arguments).map(t => t ? t.green : t));
this.writeToFile("[info]: ", ...arguments); this.writeToFile("[info]: ", ...arguments);
}; };