refactor: add severe log level

This commit is contained in:
Carlos Valente
2024-06-09 15:42:49 +02:00
committed by Carlos Valente
parent 715600a514
commit d41cd78f2e
3 changed files with 14 additions and 4 deletions
+11 -2
View File
@@ -35,8 +35,8 @@ class Logger {
* @param log
*/
private _push(log: Log) {
if (!isProduction || log.level === LogLevel.Error) {
if (log.level === LogLevel.Error) {
if (!isProduction || log.level === LogLevel.Severe) {
if (log.level === LogLevel.Severe) {
consoleRed(`[${log.level}] \t ${log.origin} \t ${log.text}`);
} else {
// eslint-disable-next-line no-console
@@ -98,6 +98,15 @@ class Logger {
this.emit(LogLevel.Error, origin, text);
}
/**
* Utility to emit logging message of type SEVERE
* @param origin
* @param text
*/
crash(origin: string, text: string) {
this.emit(LogLevel.Severe, origin, text);
}
/**
* Shutdown logger
*/