Add export logs (#978)

This commit is contained in:
Abhinav Kumar 2023-03-13 12:32:51 +05:30 committed by GitHub
commit 6971e07b4d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 0 deletions

View file

@ -34,6 +34,7 @@ import { CustomError } from 'utils/error';
import { getLocalUserDetails } from 'utils/user';
import { AppContext } from 'pages/_app';
import { getExportDirectoryDoesNotExistMessage } from 'utils/ui';
import { addLogLine } from 'utils/logging';
const ExportFolderPathContainer = styled('span')`
white-space: nowrap;
@ -289,6 +290,11 @@ export default function ExportModal(props: Props) {
const pausedStageProgress = exportRecord.progress;
setExportProgress(pausedStageProgress);
addLogLine(
`resuming export, pausedStageProgress: ${JSON.stringify(
pausedStageProgress
)}`
);
const updateExportStatsWithOffset = (progress: ExportProgress) =>
updateExportProgress({
current: pausedStageProgress.current + progress.current,

View file

@ -50,6 +50,7 @@ import { FILE_TYPE, TYPE_JPEG, TYPE_JPG } from 'constants/file';
import { ExportType, ExportNotification, RecordType } from 'constants/export';
import { ElectronAPIs } from 'types/electron';
import { CustomError } from 'utils/error';
import { addLogLine } from 'utils/logging';
const LATEST_EXPORT_VERSION = 1;
const EXPORT_RECORD_FILE_NAME = 'export_status.json';
@ -129,6 +130,14 @@ class ExportService {
}
const exportRecord = await this.getExportRecord(exportDir);
addLogLine(
`export stats -> progress: ${JSON.stringify(
exportRecord.progress
)} stage:${exportRecord.stage} queuedFilesCount: ${
exportRecord?.queuedFiles?.length
} exportedFiles: ${exportRecord?.exportedFiles?.length}
failedFiles: ${exportRecord?.failedFiles?.length}`
);
if (exportType === ExportType.NEW) {
filesToExport = getFilesUploadedAfterLastExport(
userPersonalFiles,
@ -145,6 +154,10 @@ class ExportService {
exportRecord
);
}
addLogLine(
`starting export, type: ${exportType}, filesToExportCount: ${filesToExport?.length}, userPersonalFileCount: ${userPersonalFiles?.length}`
);
const collectionIDPathMap: CollectionIDPathMap =
getCollectionIDPathMapFromExportRecord(exportRecord);
const newCollections = getCollectionsCreatedAfterLastExport(