-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add logs after some sync actions
- Loading branch information
1 parent
8c16558
commit 2a691dd
Showing
10 changed files
with
84 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { EVENTS } from './events/events'; | ||
import { LogEntity, LogSeverityLevel } from './logic/logs/domain/log.entity'; | ||
import { SaveLogs } from './logic/logs/domain/use-cases/save-logs.use-case'; | ||
import { FileSystemLogDatasource } from './logic/logs/infrastructure/file-system.log.datasource'; | ||
import { LogRepository } from './logic/logs/infrastructure/log.repository'; | ||
import { eventEmitter } from './server'; | ||
|
||
export function initFileSystemSubscribers(basePath: string) { | ||
eventEmitter.subscribe(EVENTS.SYNC_CREATED, () => { | ||
const saveLog = new SaveLogs(new LogRepository(new FileSystemLogDatasource(basePath))); | ||
saveLog.execute( | ||
new LogEntity({ | ||
message: 'Sync created', | ||
level: LogSeverityLevel.low, | ||
origin: 'electron-app', | ||
}), | ||
); | ||
}); | ||
|
||
eventEmitter.subscribe(EVENTS.SYNC_UPDATED, () => { | ||
const saveLog = new SaveLogs(new LogRepository(new FileSystemLogDatasource(basePath))); | ||
saveLog.execute( | ||
new LogEntity({ | ||
message: 'Sync updated', | ||
level: LogSeverityLevel.low, | ||
origin: 'electron-app', | ||
}), | ||
); | ||
}); | ||
|
||
eventEmitter.subscribe(EVENTS.SYNC_DELETED, () => { | ||
const saveLog = new SaveLogs(new LogRepository(new FileSystemLogDatasource(basePath))); | ||
saveLog.execute( | ||
new LogEntity({ | ||
message: 'Sync deleted', | ||
level: LogSeverityLevel.low, | ||
origin: 'electron-app', | ||
}), | ||
); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters