Skip to content

Commit

Permalink
Color output modification
Browse files Browse the repository at this point in the history
  • Loading branch information
eoftedal committed Jul 30, 2024
1 parent 39e8963 commit 5e34e91
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ let color = false;

function logMsg(logger: () => void, level: LogLevel, ...args: Array<unknown>) {
if (level == "WRN" && color) {
args.push("\x1b[0m");
// @ts-ignore
logger("\x1b[31m" + new Date().toISOString(), logId, level, ...args);
} else {
// @ts-ignore
logger(new Date().toISOString(), logId, level, ...args);
process.stdout.write("\x1b[31m");
}
// @ts-ignore
logger(new Date().toISOString(), logId, level, ...args);
if (level == "WRN" && color) {
process.stdout.write("\x1b[0m");
}
}
let level = "INF";
Expand Down

0 comments on commit 5e34e91

Please sign in to comment.