Skip to content

Commit

Permalink
fixed error file logging
Browse files Browse the repository at this point in the history
  • Loading branch information
NullDev committed Jun 2, 2023
1 parent efb687a commit d3bccf5
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/util/log.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,13 @@ class Log {
*
* @param {string} str
* @param {string} log
* @param {boolean} [error=false]
* @memberof Log
*/
static #logger(str, log){
static #logger(str, log, error = false){
console.log(str);
this.#ensureDirs();
this.#logTofile(log);
this.#logTofile(log, error);
}

/**
Expand All @@ -105,10 +106,10 @@ class Log {
*/
static error(input, trace){
const log = "[ERROR] " + this.#getDate() + " - " + input;
this.#logger(" \x1b[41m\x1b[315m x \x1b[0m\x1b[31m " + log + "\x1b[0m", log);
this.#logger(" \x1b[41m\x1b[315m x \x1b[0m\x1b[31m " + log + "\x1b[0m", log, true);
if (trace && trace.stack){
const eLog = "[TRACE] " + this.#getDate() + " - " + trace.stack;
this.#logger(" \x1b[41m\x1b[315m x \x1b[0m\x1b[31m " + eLog + "\x1b[0m", eLog);
this.#logger(" \x1b[41m\x1b[315m x \x1b[0m\x1b[31m " + eLog + "\x1b[0m", eLog, true);
}
}

Expand Down

0 comments on commit d3bccf5

Please sign in to comment.