intercept dir and pass it to the logger

This commit is contained in:
Iuri Matias 2018-04-09 15:24:01 -04:00
parent 5a91b2d44a
commit 3a89b3f951
2 changed files with 13 additions and 0 deletions

View File

@ -64,6 +64,16 @@ Logger.prototype.trace = function (txt) {
this.writeToFile("[trace]: " + txt);
};
Logger.prototype.dir = function (txt) {
if (!txt || !(this.shouldLog('info'))) {
return;
}
this.events.emit("log", "dir", txt);
this.logFunction(txt);
this.writeToFile("[dir]: ");
this.writeToFile(txt);
};
Logger.prototype.shouldLog = function (level) {
return (this.logLevels.indexOf(level) <= this.logLevels.indexOf(this.logLevel));
};

View File

@ -77,6 +77,9 @@ Plugin.prototype.interceptLogs = function(context) {
context.console.trace = function(txt) {
self.logger.trace(self.name + " > " + txt);
};
context.console.dir = function(txt) {
self.logger.dir(txt);
};
};
// TODO: add deploy provider