mirror of https://github.com/embarklabs/embark.git
feature (@embark/core): show origin of each log in the logfile logs (#2018)
This commit is contained in:
parent
fe3e604fec
commit
ee15cd4c87
|
@ -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 () {
|
||||
|
|
Loading…
Reference in New Issue