chore: prepare log levels

This commit is contained in:
Carlos Valente
2024-06-10 09:55:43 +02:00
committed by Carlos Valente
parent e9f806b88a
commit 86b4ddadb5
2 changed files with 6 additions and 3 deletions
+3 -1
View File
@@ -9,10 +9,12 @@ import { consoleSubdued, consoleRed } from '../utils/console.js';
class Logger {
private queue: Log[];
private escalateErrorFn: (error: string) => void | null;
private canLog = false;
constructor() {
this.queue = [];
this.escalateErrorFn = null;
this.canLog = !isProduction;
}
/**
@@ -43,7 +45,7 @@ class Logger {
* @param log
*/
private _push(log: Log) {
if (!isProduction || log.level === LogLevel.Severe) {
if (this.canLog || log.level === LogLevel.Severe) {
if (log.level === LogLevel.Severe) {
consoleRed(`[${log.level}] \t ${log.origin} \t ${log.text}`);
} else {