Added static events to the emitter & added it to the logger
All checks were successful
Build / Build NPM Project (push) Successful in 33s
Build / Tag Version (push) Successful in 10s
Build / Publish (push) Successful in 16s

This commit is contained in:
2024-02-28 19:19:24 -05:00
parent 74c89c3ed4
commit d4996201cf
2 changed files with 36 additions and 9 deletions

View File

@ -68,35 +68,35 @@ export class Logger extends TypedEmitter<LoggerEvents> {
debug(...args: string[]) {
if(LOG_LEVEL.VERBOSE >= Logger.LOG_LEVEL) {
this.emit('VERBOSE', ...args);
Logger.emit(LOG_LEVEL.VERBOSE, ...args);
console.debug(CliForeground.LIGHT_GREY + this.format(...args) + CliEffects.CLEAR);
}
}
error(...args: string[]) {
if(LOG_LEVEL.ERROR >= Logger.LOG_LEVEL) {
this.emit('ERROR', ...args);
Logger.emit(LOG_LEVEL.ERROR, ...args);
console.error(CliForeground.RED + this.format(...args) + CliEffects.CLEAR);
}
}
info(...args: string[]) {
if(LOG_LEVEL.INFO >= Logger.LOG_LEVEL) {
this.emit('INFO', ...args);
Logger.emit(LOG_LEVEL.INFO, ...args);
console.info(CliForeground.CYAN + this.format(...args) + CliEffects.CLEAR);
}
}
log(...args: string[]) {
if(LOG_LEVEL.INFO >= Logger.LOG_LEVEL) {
this.emit('INFO', ...args);
Logger.emit(LOG_LEVEL.INFO, ...args);
console.log(CliEffects.CLEAR + this.format(...args));
}
}
warn(...args: string[]) {
if(LOG_LEVEL.WARN >= Logger.LOG_LEVEL) {
this.emit('WARN', ...args);
Logger.emit(LOG_LEVEL.WARN, ...args);
console.warn(CliForeground.YELLOW + this.format(...args) + CliEffects.CLEAR);
}
}