add logs to export flow

This commit is contained in:
Abhinav 2023-03-13 11:23:27 +05:30
parent 6e461d9969
commit 8388df25d2
2 changed files with 12 additions and 0 deletions

View file

@ -34,6 +34,7 @@ import { CustomError } from 'utils/error';
import { getLocalUserDetails } from 'utils/user'; import { getLocalUserDetails } from 'utils/user';
import { AppContext } from 'pages/_app'; import { AppContext } from 'pages/_app';
import { getExportDirectoryDoesNotExistMessage } from 'utils/ui'; import { getExportDirectoryDoesNotExistMessage } from 'utils/ui';
import { addLogLine } from 'utils/logging';
const ExportFolderPathContainer = styled('span')` const ExportFolderPathContainer = styled('span')`
white-space: nowrap; white-space: nowrap;
@ -289,6 +290,7 @@ export default function ExportModal(props: Props) {
const pausedStageProgress = exportRecord.progress; const pausedStageProgress = exportRecord.progress;
setExportProgress(pausedStageProgress); setExportProgress(pausedStageProgress);
addLogLine(`pausedStageProgress ${pausedStageProgress}`);
const updateExportStatsWithOffset = (progress: ExportProgress) => const updateExportStatsWithOffset = (progress: ExportProgress) =>
updateExportProgress({ updateExportProgress({
current: pausedStageProgress.current + progress.current, 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 { ExportType, ExportNotification, RecordType } from 'constants/export';
import { ElectronAPIs } from 'types/electron'; import { ElectronAPIs } from 'types/electron';
import { CustomError } from 'utils/error'; import { CustomError } from 'utils/error';
import { addLogLine } from 'utils/logging';
const LATEST_EXPORT_VERSION = 1; const LATEST_EXPORT_VERSION = 1;
const EXPORT_RECORD_FILE_NAME = 'export_status.json'; const EXPORT_RECORD_FILE_NAME = 'export_status.json';
@ -129,6 +130,11 @@ class ExportService {
} }
const exportRecord = await this.getExportRecord(exportDir); const exportRecord = await this.getExportRecord(exportDir);
addLogLine(
`export stats -> progress: ${exportRecord.progress} stage:${exportRecord.stage} queuedFilesCount: ${exportRecord?.queuedFiles?.length}
exportedFiles: ${exportRecord?.exportedFiles?.length}
failedFiles: ${exportRecord?.failedFiles?.length}`
);
if (exportType === ExportType.NEW) { if (exportType === ExportType.NEW) {
filesToExport = getFilesUploadedAfterLastExport( filesToExport = getFilesUploadedAfterLastExport(
userPersonalFiles, userPersonalFiles,
@ -145,6 +151,10 @@ class ExportService {
exportRecord exportRecord
); );
} }
addLogLine(
`starting export, type=${exportType} filesToExportCount= ${filesToExport?.length} totalUserFileCount: ${userPersonalFiles?.length}`
);
const collectionIDPathMap: CollectionIDPathMap = const collectionIDPathMap: CollectionIDPathMap =
getCollectionIDPathMapFromExportRecord(exportRecord); getCollectionIDPathMapFromExportRecord(exportRecord);
const newCollections = getCollectionsCreatedAfterLastExport( const newCollections = getCollectionsCreatedAfterLastExport(