feature (@embark/core): show origin of each log in the logfile logs (#2018)

This commit is contained in:
Iuri Matias 2019-10-30 16:01:59 -04:00 committed by GitHub
parent fe3e604fec
commit ee15cd4c87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -95,8 +95,11 @@ Logger.prototype.writeToFile = function (_txt) {
if (!this.logFile) {
return;
}
let origin = "[" + ((new Error().stack).split("at ")[3]).trim() + "]";
const formattedDate = [`[${date.format(new Date(), DATE_FORMAT)}]`]; // adds a timestamp to the logs in the logFile
fs.appendFileSync(this.logFile, "\n" + formattedDate.concat(Array.from(arguments)).join(' '));
fs.appendFileSync(this.logFile, "\n" + formattedDate.concat(origin, Array.from(arguments)).join(' '));
};
Logger.prototype.error = function () {