Stop Logger being a singleton

This commit is contained in:
Andras Schmelczer 2025-02-22 15:11:59 +00:00
parent d965265709
commit 3471a9c498
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
12 changed files with 147 additions and 138 deletions

View file

@ -47,6 +47,8 @@ export class SyncHistory {
error: 0
};
public constructor(private logger: Logger) {}
public getEntries(): HistoryEntry[] {
return [...this.entries];
}
@ -78,16 +80,16 @@ export class SyncHistory {
if (entry.status === SyncStatus.SUCCESS) {
this.status.success++;
Logger.getInstance().info(
this.logger.info(
`History entry: ${entry.relativePath} - ${entry.message}`
);
} else if (entry.status === SyncStatus.ERROR) {
this.status.error++;
Logger.getInstance().error(
this.logger.error(
`Error syncing file: ${entry.relativePath} - ${entry.message}`
);
} else {
Logger.getInstance().debug(
this.logger.debug(
`No-op syncing file: ${entry.relativePath} - ${entry.message}`
);
}