refactor: unify application logging
There were multiple ways to log something in the extension:
log('Could not get Git Extension', LOG_LEVEL.ERROR);
log(`Unable to find credentials for account ...`, LOG_LEVEL.WARNING);
logError(e);
This small refactoring introduces one unified interface:
interface Log {
info(e: Error): void;
info(message: string, e?: Error): void;
warn(e: Error): void;
warn(message: string, e?: Error): void;
error(e: Error): void;
error(message: string, e?: Error): void;
}
Now you can log anywhere from the app with:
log.info('message');
log.info('message', error);
log.info(error);
The same can be done with log.warn
and log.error
.
Related to #558 (closed)
Edited by Tomas Vik (OOO back on 2024-08-12)