fix crash in logger if message is null or undefined

This commit is contained in:
roo2 2017-04-09 14:55:24 +10:00
parent 9ce25d7651
commit 5232f0e74d
1 changed files with 5 additions and 5 deletions

View File

@ -12,35 +12,35 @@ class Logger {
}
Logger.prototype.error = function (txt) {
if (!(this.shouldLog('error'))) {
if (!txt || !(this.shouldLog('error'))) {
return;
}
this.logFunction(txt.red);
};
Logger.prototype.warn = function (txt) {
if (!(this.shouldLog('warn'))) {
if (!txt || !(this.shouldLog('warn'))) {
return;
}
this.logFunction(txt.yellow);
};
Logger.prototype.info = function (txt) {
if (!(this.shouldLog('info'))) {
if (!txt || !(this.shouldLog('info'))) {
return;
}
this.logFunction(txt.green);
};
Logger.prototype.debug = function (txt) {
if (!(this.shouldLog('debug'))) {
if (!txt || !(this.shouldLog('debug'))) {
return;
}
this.logFunction(txt);
};
Logger.prototype.trace = function (txt) {
if (!(this.shouldLog('trace'))) {
if (!txt || !(this.shouldLog('trace'))) {
return;
}
this.logFunction(txt);