π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
migrate logging and sentry
Abhinavd00d029b2aa4
diff --git a/apps/photos/src/components/AuthenticateUserModal.tsx b/apps/photos/src/components/AuthenticateUserModal.tsxindex 44f63bb447..a783dd4154 100644--- a/apps/photos/src/components/AuthenticateUserModal.tsx+++ b/apps/photos/src/components/AuthenticateUserModal.tsx@@ -6,7 +6,7 @@ import { KeyAttributes, User } from 'types/user';import VerifyMasterPasswordForm, {VerifyMasterPasswordFormProps,} from '@ente/shared/components/VerifyMasterPasswordForm';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';import { t } from 'i18next';import DialogBoxV2 from '@ente/shared/components/DialogBoxV2';interface Iprops {diff --git a/apps/photos/src/components/Collections/CollectionOptions/index.tsx b/apps/photos/src/components/Collections/CollectionOptions/index.tsxindex acd9f16449..180c263125 100644--- a/apps/photos/src/components/Collections/CollectionOptions/index.tsx+++ b/apps/photos/src/components/Collections/CollectionOptions/index.tsx@@ -14,7 +14,7 @@ import { SetCollectionNamerAttributes } from '../CollectionNamer';import { Collection } from 'types/collection';import { isArchivedCollection, isPinnedCollection } from 'utils/magicMetadata';import { GalleryContext } from 'pages/gallery';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';import { VISIBILITY_STATE } from 'types/magicMetadata';import { AppContext } from 'pages/_app';import OverflowMenu from 'components/OverflowMenu/menu';diff --git a/apps/photos/src/components/Collections/CollectionShare/emailShare/ManageParticipant.tsx b/apps/photos/src/components/Collections/CollectionShare/emailShare/ManageParticipant.tsxindex 0171ff8b4e..b66b040ae1 100644--- a/apps/photos/src/components/Collections/CollectionShare/emailShare/ManageParticipant.tsx+++ b/apps/photos/src/components/Collections/CollectionShare/emailShare/ManageParticipant.tsx@@ -13,7 +13,7 @@ import MenuItemDivider from 'components/Menu/MenuItemDivider';import BlockIcon from '@mui/icons-material/Block';import DoneIcon from '@mui/icons-material/Done';import { handleSharingErrors } from 'utils/error/ui';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';import { shareCollection } from 'services/collectionService';import { GalleryContext } from 'pages/gallery';import { AppContext } from 'pages/_app';diff --git a/apps/photos/src/components/DeleteAccountModal.tsx b/apps/photos/src/components/DeleteAccountModal.tsxindex 1be84d7744..79643643b7 100644--- a/apps/photos/src/components/DeleteAccountModal.tsx+++ b/apps/photos/src/components/DeleteAccountModal.tsx@@ -3,7 +3,7 @@ import { AppContext } from 'pages/_app';import { useContext, useEffect, useRef, useState } from 'react';import { preloadImage, initiateEmail } from 'utils/common';import { deleteAccount, getAccountDeleteChallenge } from 'services/userService';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';import { decryptDeleteAccountChallenge } from 'utils/crypto';import { Trans } from 'react-i18next';import { t } from 'i18next';diff --git a/apps/photos/src/components/ExportModal.tsx b/apps/photos/src/components/ExportModal.tsxindex 30b0cc8264..3ae7db2269 100644--- a/apps/photos/src/components/ExportModal.tsx+++ b/apps/photos/src/components/ExportModal.tsx@@ -13,7 +13,7 @@ import {Tooltip,Typography,} from '@mui/material';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';import { SpaceBetweenFlex, VerticallyCenteredFlex } from './Container';import ExportFinished from './ExportFinished';import ExportInit from './ExportInit';@@ -29,7 +29,7 @@ import { getExportDirectoryDoesNotExistMessage } from 'utils/ui';import { t } from 'i18next';import LinkButton from './pages/gallery/LinkButton';import { CustomError } from 'utils/error';-import { addLogLine } from 'utils/logging';+import { addLogLine } from '@ente/shared/logging';import { EnteFile } from 'types/file';const ExportFolderPathContainer = styled(LinkButton)`diff --git a/apps/photos/src/components/FixLargeThumbnail.tsx b/apps/photos/src/components/FixLargeThumbnail.tsxindex 68a06af0e1..579439d279 100644--- a/apps/photos/src/components/FixLargeThumbnail.tsx+++ b/apps/photos/src/components/FixLargeThumbnail.tsx@@ -7,7 +7,7 @@ import {replaceThumbnail,} from 'services/migrateThumbnailService';import { getData, LS_KEYS, setData } from 'utils/storage/localStorage';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';import { t } from 'i18next';export type SetProgressTracker = React.Dispatch<diff --git a/apps/photos/src/components/MachineLearning/ImageViews.tsx b/apps/photos/src/components/MachineLearning/ImageViews.tsxindex 240843d6d6..66930f9520 100644--- a/apps/photos/src/components/MachineLearning/ImageViews.tsx+++ b/apps/photos/src/components/MachineLearning/ImageViews.tsx@@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react';import { Skeleton, styled } from '@mui/material';import { imageBitmapToBlob } from 'utils/image';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';import { getBlobFromCache } from 'utils/storage/cache';export const FaceCropsRow = styled('div')`diff --git a/apps/photos/src/components/MachineLearning/MLFileDebugView.tsx b/apps/photos/src/components/MachineLearning/MLFileDebugView.tsxindex 258b06bd93..b660054ee0 100644--- a/apps/photos/src/components/MachineLearning/MLFileDebugView.tsx+++ b/apps/photos/src/components/MachineLearning/MLFileDebugView.tsx@@ -16,7 +16,7 @@ import { FaceCropsRow, FaceImagesRow, ImageBitmapView } from './ImageViews';import ssdMobileNetV2Service from 'services/machineLearning/ssdMobileNetV2Service';import { DEFAULT_ML_SYNC_CONFIG } from 'constants/mlConfig';import imageSceneService from 'services/machineLearning/imageSceneService';-import { addLogLine } from 'utils/logging';+import { addLogLine } from '@ente/shared/logging';interface MLFileDebugViewProps {file: File;diff --git a/apps/photos/src/components/MachineLearning/MLSearchSettings/index.tsx b/apps/photos/src/components/MachineLearning/MLSearchSettings/index.tsxindex 667497c356..0953496e5b 100644--- a/apps/photos/src/components/MachineLearning/MLSearchSettings/index.tsx+++ b/apps/photos/src/components/MachineLearning/MLSearchSettings/index.tsx@@ -8,7 +8,7 @@ import {getFaceSearchEnabledStatus,updateFaceSearchEnabledStatus,} from 'services/userService';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';import EnableFaceSearch from './enableFaceSearch';import EnableMLSearch from './enableMLSearch';import ManageMLSearch from './manageMLSearch';diff --git a/apps/photos/src/components/MachineLearning/PeopleList.tsx b/apps/photos/src/components/MachineLearning/PeopleList.tsxindex 2c697997f9..3348ae31c9 100644--- a/apps/photos/src/components/MachineLearning/PeopleList.tsx+++ b/apps/photos/src/components/MachineLearning/PeopleList.tsx@@ -10,8 +10,8 @@ import { EnteFile } from 'types/file';import { ImageCacheView } from './ImageViews';import { CACHES } from 'constants/cache';import { Legend } from 'components/PhotoViewer/styledComponents/Legend';-import { addLogLine } from 'utils/logging';-import { logError } from 'utils/sentry';+import { addLogLine } from '@ente/shared/logging';+import { logError } from '@ente/shared/sentry';import { t } from 'i18next';const FaceChipContainer = styled('div')`diff --git a/apps/photos/src/components/PhotoFrame.tsx b/apps/photos/src/components/PhotoFrame.tsxindex ebfca71568..de0a032361 100644--- a/apps/photos/src/components/PhotoFrame.tsx+++ b/apps/photos/src/components/PhotoFrame.tsx@@ -13,8 +13,8 @@ import { MergedSourceURL, SelectedState } from 'types/gallery';import PublicCollectionDownloadManager from 'services/publicCollectionDownloadManager';import { PublicCollectionGalleryContext } from 'utils/publicCollectionGallery';import { useRouter } from 'next/router';-import { logError } from 'utils/sentry';-import { addLogLine } from 'utils/logging';+import { logError } from '@ente/shared/sentry';+import { addLogLine } from '@ente/shared/logging';import PhotoSwipe from 'photoswipe';import useMemoSingleThreaded from '@ente/shared/hooks/useMemoSingleThreaded';import { getPlayableVideo } from 'utils/file';diff --git a/apps/photos/src/components/PhotoViewer/FileInfo/RenderCaption.tsx b/apps/photos/src/components/PhotoViewer/FileInfo/RenderCaption.tsxindex eb26d132ec..ae3d42e378 100644--- a/apps/photos/src/components/PhotoViewer/FileInfo/RenderCaption.tsx+++ b/apps/photos/src/components/PhotoViewer/FileInfo/RenderCaption.tsx@@ -1,7 +1,7 @@import React, { useState } from 'react';import { EnteFile } from 'types/file';import { changeCaption, updateExistingFilePubMetadata } from 'utils/file';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';import { Box, IconButton, TextField } from '@mui/material';import { FlexWrapper } from 'components/Container';import { MAX_CAPTION_SIZE } from 'constants/file';diff --git a/apps/photos/src/components/PhotoViewer/FileInfo/RenderCreationTime.tsx b/apps/photos/src/components/PhotoViewer/FileInfo/RenderCreationTime.tsxindex 47910988b7..f3487f34fa 100644--- a/apps/photos/src/components/PhotoViewer/FileInfo/RenderCreationTime.tsx+++ b/apps/photos/src/components/PhotoViewer/FileInfo/RenderCreationTime.tsx@@ -7,7 +7,7 @@ import {} from 'utils/file';import { formatDate, formatTime } from 'utils/time/format';import { FlexWrapper } from 'components/Container';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';import EnteDateTimePicker from 'components/EnteDateTimePicker';import InfoItem from './InfoItem';diff --git a/apps/photos/src/components/PhotoViewer/FileInfo/RenderFileName.tsx b/apps/photos/src/components/PhotoViewer/FileInfo/RenderFileName.tsxindex 343e6d3266..b9c8bdd6b2 100644--- a/apps/photos/src/components/PhotoViewer/FileInfo/RenderFileName.tsx+++ b/apps/photos/src/components/PhotoViewer/FileInfo/RenderFileName.tsx@@ -6,7 +6,7 @@ import {updateExistingFilePubMetadata,} from 'utils/file';import { FlexWrapper } from 'components/Container';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';import { FILE_TYPE } from 'constants/file';import InfoItem from './InfoItem';import { makeHumanReadableStorage } from 'utils/billing';diff --git a/apps/photos/src/components/PhotoViewer/ImageEditorOverlay/TransformMenu.tsx b/apps/photos/src/components/PhotoViewer/ImageEditorOverlay/TransformMenu.tsxindex 9277771da1..3761dc32d1 100644--- a/apps/photos/src/components/PhotoViewer/ImageEditorOverlay/TransformMenu.tsx+++ b/apps/photos/src/components/PhotoViewer/ImageEditorOverlay/TransformMenu.tsx@@ -11,7 +11,7 @@ import RotateRightIcon from '@mui/icons-material/RotateRight';import FlipIcon from '@mui/icons-material/Flip';import MenuItemDivider from 'components/Menu/MenuItemDivider';import { t } from 'i18next';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';const PRESET_ASPECT_RATIOS = [{diff --git a/apps/photos/src/components/PhotoViewer/ImageEditorOverlay/index.tsx b/apps/photos/src/components/PhotoViewer/ImageEditorOverlay/index.tsxindex efad2e3f01..315cd7ddf5 100644--- a/apps/photos/src/components/PhotoViewer/ImageEditorOverlay/index.tsx+++ b/apps/photos/src/components/PhotoViewer/ImageEditorOverlay/index.tsx@@ -41,7 +41,7 @@ import ChevronRightIcon from '@mui/icons-material/ChevronRight';import MenuIcon from '@mui/icons-material/Menu';import { AppContext } from 'pages/_app';import { getEditorCloseConfirmationMessage } from 'utils/ui';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';import { getFileType } from 'services/typeDetectionService';import { downloadUsingAnchor } from 'utils/file';diff --git a/apps/photos/src/components/PhotoViewer/index.tsx b/apps/photos/src/components/PhotoViewer/index.tsxindex cd75087d9b..afd0da055d 100644--- a/apps/photos/src/components/PhotoViewer/index.tsx+++ b/apps/photos/src/components/PhotoViewer/index.tsx@@ -14,7 +14,7 @@ import {getFileFromURL,isRawFileFromFileName,} from 'utils/file';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';import { FILE_TYPE } from 'constants/file';import { isClipboardItemPresent } from 'utils/common';@@ -40,7 +40,7 @@ import DeleteIcon from '@mui/icons-material/Delete';import { trashFiles } from 'services/fileService';import { getTrashFileMessage } from 'utils/ui';import { Box, Button, styled } from '@mui/material';-import { addLocalLog } from 'utils/logging';+import { addLocalLog } from '@ente/shared/logging';import ContentCopy from '@mui/icons-material/ContentCopy';import ChevronLeft from '@mui/icons-material/ChevronLeft';import { t } from 'i18next';diff --git a/apps/photos/src/components/Sidebar/DebugSection.tsx b/apps/photos/src/components/Sidebar/DebugSection.tsxindex 6aa224d13f..e3e7597d9f 100644--- a/apps/photos/src/components/Sidebar/DebugSection.tsx+++ b/apps/photos/src/components/Sidebar/DebugSection.tsx@@ -4,7 +4,8 @@ import { downloadAsFile } from 'utils/file';import { Trans } from 'react-i18next';import { t } from 'i18next';-import { addLogLine, getDebugLogs } from 'utils/logging';+import { addLogLine } from '@ente/shared/logging';+import { getDebugLogs } from '@ente/shared/logging/web';import isElectron from 'is-electron';import ElectronService from 'services/electron/common';import Typography from '@mui/material/Typography';diff --git a/apps/photos/src/components/Sidebar/MapSetting/ModifyMapEnabled.tsx b/apps/photos/src/components/Sidebar/MapSetting/ModifyMapEnabled.tsxindex a87abb132b..f878a68ca7 100644--- a/apps/photos/src/components/Sidebar/MapSetting/ModifyMapEnabled.tsx+++ b/apps/photos/src/components/Sidebar/MapSetting/ModifyMapEnabled.tsx@@ -2,7 +2,7 @@ import { Box, DialogProps } from '@mui/material';import { EnteDrawer } from 'components/EnteDrawer';import { AppContext } from 'pages/_app';import { useContext } from 'react';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';import EnableMap from '../EnableMap';import DisableMap from '../DisableMap';diff --git a/apps/photos/src/components/Sidebar/Preferences/index.tsx b/apps/photos/src/components/Sidebar/Preferences/index.tsxindex a7930487e7..c1ae7cc8f3 100644--- a/apps/photos/src/components/Sidebar/Preferences/index.tsx+++ b/apps/photos/src/components/Sidebar/Preferences/index.tsx@@ -14,7 +14,7 @@ import { LS_KEYS } from 'utils/storage/localStorage';import { useLocalState } from '@ente/shared/hooks/useLocalState';import ElectronService from 'services/electron/common';import InMemoryStore, { MS_KEYS } from 'services/InMemoryStore';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';export default function Preferences({ open, onClose, onRootClose }) {const [advancedSettingsView, setAdvancedSettingsView] = useState(false);diff --git a/apps/photos/src/components/Upload/Uploader.tsx b/apps/photos/src/components/Upload/Uploader.tsxindex 37bf6ccc23..23ad33c6a2 100644--- a/apps/photos/src/components/Upload/Uploader.tsx+++ b/apps/photos/src/components/Upload/Uploader.tsx@@ -15,7 +15,7 @@ import {} from 'types/gallery';import { GalleryContext } from 'pages/gallery';import { AppContext } from 'pages/_app';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';import uploadManager from 'services/upload/uploadManager';import ImportService from 'services/importService';import isElectron from 'is-electron';@@ -56,7 +56,7 @@ import {groupFilesBasedOnParentFolder,} from 'utils/upload';import billingService from 'services/billingService';-import { addLogLine } from 'utils/logging';+import { addLogLine } from '@ente/shared/logging';import { PublicCollectionGalleryContext } from 'utils/publicCollectionGallery';import UserNameInputDialog from 'components/UserNameInputDialog';import {diff --git a/apps/photos/src/components/pages/gallery/Avatar.tsx b/apps/photos/src/components/pages/gallery/Avatar.tsxindex 401cf30749..323508dd76 100644--- a/apps/photos/src/components/pages/gallery/Avatar.tsx+++ b/apps/photos/src/components/pages/gallery/Avatar.tsx@@ -3,7 +3,7 @@ import { EnteFile } from 'types/file';import { GalleryContext } from 'pages/gallery';import { styled } from '@mui/material';import { useTheme } from '@mui/material/styles';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';interface AvatarProps {file?: EnteFile;diff --git a/apps/photos/src/components/pages/gallery/PlanSelector/card/index.tsx b/apps/photos/src/components/pages/gallery/PlanSelector/card/index.tsxindex c3fc8893ac..b1887cc6d7 100644--- a/apps/photos/src/components/pages/gallery/PlanSelector/card/index.tsx+++ b/apps/photos/src/components/pages/gallery/PlanSelector/card/index.tsx@@ -16,7 +16,7 @@ import { reverseString } from 'utils/common';import { GalleryContext } from 'pages/gallery';import billingService from 'services/billingService';import { SetLoading } from 'types/gallery';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';import { AppContext } from 'pages/_app';import { Link, Stack } from '@mui/material';import { useLocalState } from '@ente/shared/hooks/useLocalState';diff --git a/apps/photos/src/components/pages/gallery/PreviewCard.tsx b/apps/photos/src/components/pages/gallery/PreviewCard.tsxindex 566f31b142..37ec7cd4f4 100644--- a/apps/photos/src/components/pages/gallery/PreviewCard.tsx+++ b/apps/photos/src/components/pages/gallery/PreviewCard.tsx@@ -9,7 +9,7 @@ import { GAP_BTW_TILES, IMAGE_CONTAINER_MAX_WIDTH } from 'constants/gallery';import { PublicCollectionGalleryContext } from 'utils/publicCollectionGallery';import PublicCollectionDownloadManager from 'services/publicCollectionDownloadManager';import { DeduplicateContext } from 'pages/deduplicate';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';import { Overlay } from 'components/Container';import { TRASH_SECTION } from 'constants/collection';import { formatDateRelative } from 'utils/time/format';diff --git a/apps/photos/src/constants/sentry.ts b/apps/photos/src/constants/sentry.tsdeleted file mode 100644index a8a05aff9d..0000000000--- a/apps/photos/src/constants/sentry.ts+++ /dev/null@@ -1,15 +0,0 @@-export const ENV_DEVELOPMENT = 'development';-export const ENV_PRODUCTION = 'production';--export const getSentryDSN = () =>- process.env.NEXT_PUBLIC_SENTRY_DSN ??- 'https://[email protected]/2';--export const getSentryENV = () =>- process.env.NEXT_PUBLIC_SENTRY_ENV ?? ENV_PRODUCTION;--export const getSentryRelease = () => process.env.SENTRY_RELEASE;--export { getIsSentryEnabled } from '../../sentryConfigUtil';--export const isDEVSentryENV = () => getSentryENV() === ENV_DEVELOPMENT;diff --git a/apps/photos/src/pages/gallery/index.tsx b/apps/photos/src/pages/gallery/index.tsxindex 0c06ad180f..2ad5478888 100644--- a/apps/photos/src/pages/gallery/index.tsx+++ b/apps/photos/src/pages/gallery/index.tsx@@ -82,7 +82,7 @@ import {getSelectedCollection,getDefaultHiddenCollectionIDs,} from 'utils/collection';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';import { getLocalTrashedFiles, syncTrash } from 'services/trashService';import FixCreationTime, {diff --git a/apps/photos/src/pages/index.tsx b/apps/photos/src/pages/index.tsxindex 97848f89f1..25fbbd1917 100644--- a/apps/photos/src/pages/index.tsx+++ b/apps/photos/src/pages/index.tsx@@ -10,7 +10,7 @@ import EnteSpinner from '@ente/shared/components/EnteSpinner';import { t } from 'i18next';import localForage from 'utils/storage/localForage';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';import { PHOTOS_PAGES as PAGES } from '@ente/shared/constants/pages';import { EnteLogo } from '@ente/shared/components/EnteLogo';import isElectron from 'is-electron';diff --git a/apps/photos/src/pages/shared-albums/index.tsx b/apps/photos/src/pages/shared-albums/index.tsxindex 877d155630..0348e4d5ce 100644--- a/apps/photos/src/pages/shared-albums/index.tsx+++ b/apps/photos/src/pages/shared-albums/index.tsx@@ -33,7 +33,7 @@ import { useRouter } from 'next/router';import SingleInputForm, {SingleInputFormProps,} from '@ente/shared/components/SingleInputForm';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';import SharedAlbumNavbar from 'components/pages/sharedAlbum/Navbar';import { CollectionInfo } from 'components/Collections/CollectionInfo';import { CollectionInfoBarWrapper } from 'components/Collections/styledComponents';diff --git a/apps/photos/src/services/HTTPService.ts b/apps/photos/src/services/HTTPService.tsindex b42b16286b..e6f7945755 100644--- a/apps/photos/src/services/HTTPService.ts+++ b/apps/photos/src/services/HTTPService.ts@@ -1,6 +1,6 @@import axios, { AxiosRequestConfig, AxiosResponse } from 'axios';-import { addLogLine } from 'utils/logging';-import { logError } from 'utils/sentry';+import { addLogLine } from '@ente/shared/logging';+import { logError } from '@ente/shared/sentry';import { ApiError, CustomError, isApiErrorResponse } from 'utils/error';interface IHTTPHeaders {diff --git a/apps/photos/src/services/authenticator/authenticatorService.ts b/apps/photos/src/services/authenticator/authenticatorService.tsindex cb8baf277b..28fe17e600 100644--- a/apps/photos/src/services/authenticator/authenticatorService.ts+++ b/apps/photos/src/services/authenticator/authenticatorService.ts@@ -6,7 +6,7 @@ import ComlinkCryptoWorker from 'utils/comlink/ComlinkCryptoWorker';import { getEndpoint } from 'utils/common/apiUtil';import { getActualKey, getToken } from 'utils/common/key';import { ApiError, CustomError } from 'utils/error';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';const ENDPOINT = getEndpoint();export const getAuthCodes = async (): Promise<Code[]> => {diff --git a/apps/photos/src/services/billingService.ts b/apps/photos/src/services/billingService.tsindex 19807bd165..992a956e68 100644--- a/apps/photos/src/services/billingService.ts+++ b/apps/photos/src/services/billingService.ts@@ -2,7 +2,7 @@ import { getEndpoint, getPaymentsURL } from 'utils/common/apiUtil';import { getToken } from 'utils/common/key';import { setData, LS_KEYS, removeData } from 'utils/storage/localStorage';import HTTPService from './HTTPService';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';import { getPaymentToken } from './userService';import { Plan, Subscription } from 'types/billing';import isElectron from 'is-electron';diff --git a/apps/photos/src/services/cache/cacheStorageService.ts b/apps/photos/src/services/cache/cacheStorageService.tsindex adb9731dd9..87df2063bf 100644--- a/apps/photos/src/services/cache/cacheStorageService.ts+++ b/apps/photos/src/services/cache/cacheStorageService.ts@@ -1,4 +1,4 @@-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';import { CacheStorageFactory } from './cacheStorageFactory';const SecurityError = 'SecurityError';diff --git a/apps/photos/src/services/collectionService.ts b/apps/photos/src/services/collectionService.tsindex da30a5f96e..01b7ebd972 100644--- a/apps/photos/src/services/collectionService.ts+++ b/apps/photos/src/services/collectionService.ts@@ -6,7 +6,7 @@ import { getActualKey, getToken } from 'utils/common/key';import { getPublicKey } from './userService';import HTTPService from './HTTPService';import { EnteFile } from 'types/file';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';import { CustomError } from 'utils/error';import {sortFiles,diff --git a/apps/photos/src/services/deduplicationService.ts b/apps/photos/src/services/deduplicationService.tsindex 0b1ca5548a..b9f1768c2e 100644--- a/apps/photos/src/services/deduplicationService.ts+++ b/apps/photos/src/services/deduplicationService.ts@@ -3,7 +3,7 @@ import { EnteFile } from 'types/file';import { Metadata } from 'types/upload';import { getEndpoint } from 'utils/common/apiUtil';import { getToken } from 'utils/common/key';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';import { hasFileHash } from 'utils/upload';import HTTPService from './HTTPService';diff --git a/apps/photos/src/services/downloadManager.ts b/apps/photos/src/services/downloadManager.tsindex dac29b5a9c..65dea581e7 100644--- a/apps/photos/src/services/downloadManager.ts+++ b/apps/photos/src/services/downloadManager.ts@@ -8,7 +8,7 @@ import {import HTTPService from './HTTPService';import { EnteFile } from 'types/file';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';import { FILE_TYPE } from 'constants/file';import { CustomError } from 'utils/error';import ComlinkCryptoWorker from 'utils/comlink/ComlinkCryptoWorker';@@ -18,7 +18,7 @@ import { Remote } from 'comlink';import { DedicatedCryptoWorker } from 'worker/crypto.worker';import { LimitedCache } from 'types/cache';import { retryAsyncFunction } from 'utils/network';-import { addLogLine } from 'utils/logging';+import { addLogLine } from '@ente/shared/logging';class DownloadManager {private fileObjectURLPromise = new Map<diff --git a/apps/photos/src/services/electron/fs.ts b/apps/photos/src/services/electron/fs.tsindex 6e57ff2908..27be0f7012 100644--- a/apps/photos/src/services/electron/fs.ts+++ b/apps/photos/src/services/electron/fs.ts@@ -1,5 +1,5 @@import { ElectronAPIs } from 'types/electron';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';class ElectronFSService {private electronAPIs: ElectronAPIs;diff --git a/apps/photos/src/services/electron/imageProcessor.ts b/apps/photos/src/services/electron/imageProcessor.tsindex ca543a43e8..c5719cf44e 100644--- a/apps/photos/src/services/electron/imageProcessor.ts+++ b/apps/photos/src/services/electron/imageProcessor.ts@@ -2,8 +2,8 @@ import { ElectronAPIs } from 'types/electron';import { ElectronFile } from 'types/upload';import { CustomError } from 'utils/error';import { convertBytesToHumanReadable } from 'utils/file/size';-import { addLogLine } from 'utils/logging';-import { logError } from 'utils/sentry';+import { addLogLine } from '@ente/shared/logging';+import { logError } from '@ente/shared/sentry';class ElectronImageProcessorService {private electronAPIs: ElectronAPIs;diff --git a/apps/photos/src/services/electron/safeStorage.tsx b/apps/photos/src/services/electron/safeStorage.tsxindex 3d80ef79ca..de4f1e9efe 100644--- a/apps/photos/src/services/electron/safeStorage.tsx+++ b/apps/photos/src/services/electron/safeStorage.tsx@@ -1,5 +1,5 @@import { ElectronAPIs } from 'types/electron';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';class SafeStorageService {private electronAPIs: ElectronAPIs;diff --git a/apps/photos/src/services/entityService.ts b/apps/photos/src/services/entityService.tsindex 38367852fc..aee8c664fd 100644--- a/apps/photos/src/services/entityService.ts+++ b/apps/photos/src/services/entityService.ts@@ -2,7 +2,7 @@ import { getToken } from 'utils/common/key';import localForage from 'utils/storage/localForage';import HTTPService from './HTTPService';import { getEndpoint } from 'utils/common/apiUtil';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';import ComlinkCryptoWorker from 'utils/comlink/ComlinkCryptoWorker';import { getActualKey } from 'utils/common/key';import {@@ -14,7 +14,7 @@ import {EncryptedEntity,} from 'types/entity';import { getLatestVersionEntities } from 'utils/entity';-import { addLogLine } from 'utils/logging';+import { addLogLine } from '@ente/shared/logging';const ENDPOINT = getEndpoint();diff --git a/apps/photos/src/services/export/index.ts b/apps/photos/src/services/export/index.tsindex daf5eb3718..8a69196056 100644--- a/apps/photos/src/services/export/index.ts+++ b/apps/photos/src/services/export/index.ts@@ -22,7 +22,7 @@ import {parseLivePhotoExportName,getCollectionIDFromFileUID,} from 'utils/export';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';import { getData, LS_KEYS, setData } from 'utils/storage/localStorage';import { getAllLocalCollections } from '../collectionService';import downloadManager from '../downloadManager';@@ -53,7 +53,7 @@ import { FILE_TYPE } from 'constants/file';import { ExportStage } from 'constants/export';import { ElectronAPIs } from 'types/electron';import { CustomError } from 'utils/error';-import { addLogLine } from 'utils/logging';+import { addLogLine } from '@ente/shared/logging';import { eventBus, Events } from '../events';import {constructCollectionNameMap,diff --git a/apps/photos/src/services/export/migration.ts b/apps/photos/src/services/export/migration.tsindex ab93adbbba..9815df1243 100644--- a/apps/photos/src/services/export/migration.ts+++ b/apps/photos/src/services/export/migration.ts@@ -24,8 +24,8 @@ import {getPersonalFiles,mergeMetadata,} from 'utils/file';-import { addLocalLog, addLogLine } from 'utils/logging';-import { logError } from 'utils/sentry';+import { addLocalLog, addLogLine } from '@ente/shared/logging';+import { logError } from '@ente/shared/sentry';import { getData, LS_KEYS } from 'utils/storage/localStorage';import exportService from './index';import { Collection } from 'types/collection';diff --git a/apps/photos/src/services/ffmpeg/ffmpegService.ts b/apps/photos/src/services/ffmpeg/ffmpegService.tsindex 4a0148194d..edfa65a2aa 100644--- a/apps/photos/src/services/ffmpeg/ffmpegService.ts+++ b/apps/photos/src/services/ffmpeg/ffmpegService.ts@@ -5,7 +5,7 @@ import {} from 'constants/ffmpeg';import { ElectronFile } from 'types/upload';import { parseFFmpegExtractedMetadata } from 'utils/ffmpeg';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';import ffmpegFactory from './ffmpegFactory';export async function generateVideoThumbnail(diff --git a/apps/photos/src/services/fileService.ts b/apps/photos/src/services/fileService.tsindex a39953ebcc..0726841fa6 100644--- a/apps/photos/src/services/fileService.ts+++ b/apps/photos/src/services/fileService.ts@@ -4,7 +4,7 @@ import localForage from 'utils/storage/localForage';import { getToken } from 'utils/common/key';import { Collection } from 'types/collection';import HTTPService from './HTTPService';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';import {decryptFile,getLatestVersionFiles,@@ -21,7 +21,7 @@ import {} from 'types/file';import { SetFiles } from 'types/gallery';import { BulkUpdateMagicMetadataRequest } from 'types/magicMetadata';-import { addLogLine } from 'utils/logging';+import { addLogLine } from '@ente/shared/logging';import ComlinkCryptoWorker from 'utils/comlink/ComlinkCryptoWorker';import {getCollectionLastSyncTime,diff --git a/apps/photos/src/services/heicConversionService.ts b/apps/photos/src/services/heicConversionService.tsindex 64efb87da3..00f49b7db8 100644--- a/apps/photos/src/services/heicConversionService.ts+++ b/apps/photos/src/services/heicConversionService.ts@@ -1,4 +1,4 @@-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';import WasmHEICConverterService from './wasmHeicConverter/wasmHEICConverterService';class HeicConversionService {diff --git a/apps/photos/src/services/importService.ts b/apps/photos/src/services/importService.tsindex de6d8026fb..f142892506 100644--- a/apps/photos/src/services/importService.ts+++ b/apps/photos/src/services/importService.ts@@ -2,7 +2,7 @@ import { PICKED_UPLOAD_TYPE } from 'constants/upload';import { Collection } from 'types/collection';import { ElectronAPIs } from 'types/electron';import { ElectronFile, FileWithCollection } from 'types/upload';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';interface PendingUploads {files: ElectronFile[];diff --git a/apps/photos/src/services/machineLearning/blazeFaceDetectionService.ts b/apps/photos/src/services/machineLearning/blazeFaceDetectionService.tsindex 731894d2d1..97a16976eb 100644--- a/apps/photos/src/services/machineLearning/blazeFaceDetectionService.ts+++ b/apps/photos/src/services/machineLearning/blazeFaceDetectionService.ts@@ -33,7 +33,7 @@ import {BLAZEFACE_SCORE_THRESHOLD,MAX_FACE_DISTANCE_PERCENT,} from 'constants/mlConfig';-import { addLogLine } from 'utils/logging';+import { addLogLine } from '@ente/shared/logging';class BlazeFaceDetectionService implements FaceDetectionService {private blazeFaceModel: Promise<BlazeFaceModel>;diff --git a/apps/photos/src/services/machineLearning/faceService.ts b/apps/photos/src/services/machineLearning/faceService.tsindex eb0f551c80..d11a59775d 100644--- a/apps/photos/src/services/machineLearning/faceService.ts+++ b/apps/photos/src/services/machineLearning/faceService.ts@@ -4,7 +4,7 @@ import {DetectedFace,Face,} from 'types/machineLearning';-import { addLogLine } from 'utils/logging';+import { addLogLine } from '@ente/shared/logging';import {isDifferentOrOld,getFaceId,diff --git a/apps/photos/src/services/machineLearning/imageSceneService.ts b/apps/photos/src/services/machineLearning/imageSceneService.tsindex 8a17dafce0..ac23218bcc 100644--- a/apps/photos/src/services/machineLearning/imageSceneService.ts+++ b/apps/photos/src/services/machineLearning/imageSceneService.ts@@ -8,7 +8,7 @@ import {} from 'types/machineLearning';import { SCENE_DETECTION_IMAGE_SIZE } from 'constants/mlConfig';import { resizeToSquare } from 'utils/image';-import { addLogLine } from 'utils/logging';+import { addLogLine } from '@ente/shared/logging';class ImageScene implements SceneDetectionService {method: Versioned<SceneDetectionMethod>;diff --git a/apps/photos/src/services/machineLearning/machineLearningFactory.ts b/apps/photos/src/services/machineLearning/machineLearningFactory.tsindex dba95b34e4..67e7f98593 100644--- a/apps/photos/src/services/machineLearning/machineLearningFactory.ts+++ b/apps/photos/src/services/machineLearning/machineLearningFactory.ts@@ -33,7 +33,7 @@ import imageSceneService from './imageSceneService';import { getDedicatedCryptoWorker } from 'utils/comlink/ComlinkCryptoWorker';import { ComlinkWorker } from 'utils/comlink/comlinkWorker';import { DedicatedCryptoWorker } from 'worker/crypto.worker';-import { addLogLine } from 'utils/logging';+import { addLogLine } from '@ente/shared/logging';export class MLFactory {public static getFaceDetectionService(diff --git a/apps/photos/src/services/machineLearning/machineLearningService.ts b/apps/photos/src/services/machineLearning/machineLearningService.tsindex f9e4d50362..c28b60f7cd 100644--- a/apps/photos/src/services/machineLearning/machineLearningService.ts+++ b/apps/photos/src/services/machineLearning/machineLearningService.ts@@ -31,8 +31,8 @@ import PeopleService from './peopleService';import ObjectService from './objectService';// import TextService from './textService';import ReaderService from './readerService';-import { logError } from 'utils/sentry';-import { addLogLine } from 'utils/logging';+import { logError } from '@ente/shared/sentry';+import { addLogLine } from '@ente/shared/logging';class MachineLearningService {private initialized = false;// private faceDetectionService: FaceDetectionService;diff --git a/apps/photos/src/services/machineLearning/mlWorkManager.ts b/apps/photos/src/services/machineLearning/mlWorkManager.tsindex eef9757f40..834a7cf8bb 100644--- a/apps/photos/src/services/machineLearning/mlWorkManager.ts+++ b/apps/photos/src/services/machineLearning/mlWorkManager.ts@@ -6,13 +6,13 @@ import { FILE_TYPE } from 'constants/file';import { getToken, getUserID } from 'utils/common/key';import { logQueueStats } from 'utils/machineLearning';import { getMLSyncJobConfig } from 'utils/machineLearning/config';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';import mlIDbStorage from 'utils/storage/mlIDbStorage';import { MLSyncJobResult, MLSyncJob } from './mlSyncJob';import { ComlinkWorker } from 'utils/comlink/comlinkWorker';import { DedicatedMLWorker } from 'worker/ml.worker';import { getDedicatedMLWorker } from 'utils/comlink/ComlinkMLWorker';-import { addLogLine } from 'utils/logging';+import { addLogLine } from '@ente/shared/logging';const LIVE_SYNC_IDLE_DEBOUNCE_SEC = 30;const LIVE_SYNC_QUEUE_TIMEOUT_SEC = 300;diff --git a/apps/photos/src/services/machineLearning/mobileFaceNetEmbeddingService.ts b/apps/photos/src/services/machineLearning/mobileFaceNetEmbeddingService.tsindex d2b78c8b1a..850af11d43 100644--- a/apps/photos/src/services/machineLearning/mobileFaceNetEmbeddingService.ts+++ b/apps/photos/src/services/machineLearning/mobileFaceNetEmbeddingService.ts@@ -8,7 +8,7 @@ import {FaceEmbeddingService,Versioned,} from 'types/machineLearning';-import { addLogLine } from 'utils/logging';+import { addLogLine } from '@ente/shared/logging';import { imageBitmapsToTensor4D } from 'utils/machineLearning';class MobileFaceNetEmbeddingService implements FaceEmbeddingService {diff --git a/apps/photos/src/services/machineLearning/objectService.ts b/apps/photos/src/services/machineLearning/objectService.tsindex b174b21b14..263a1b7901 100644--- a/apps/photos/src/services/machineLearning/objectService.ts+++ b/apps/photos/src/services/machineLearning/objectService.ts@@ -4,7 +4,7 @@ import {DetectedObject,Thing,} from 'types/machineLearning';-import { addLogLine } from 'utils/logging';+import { addLogLine } from '@ente/shared/logging';import {isDifferentOrOld,getObjectId,diff --git a/apps/photos/src/services/machineLearning/peopleService.ts b/apps/photos/src/services/machineLearning/peopleService.tsindex eaa0aa3674..59dc5d4b92 100644--- a/apps/photos/src/services/machineLearning/peopleService.ts+++ b/apps/photos/src/services/machineLearning/peopleService.ts@@ -1,5 +1,5 @@import { Face, MLSyncContext, Person } from 'types/machineLearning';-import { addLogLine } from 'utils/logging';+import { addLogLine } from '@ente/shared/logging';import {isDifferentOrOld,getAllFacesFromMap,diff --git a/apps/photos/src/services/machineLearning/readerService.ts b/apps/photos/src/services/machineLearning/readerService.tsindex 3149e16c44..499eef3557 100644--- a/apps/photos/src/services/machineLearning/readerService.ts+++ b/apps/photos/src/services/machineLearning/readerService.ts@@ -5,7 +5,7 @@ import {getOriginalImageBitmap,getThumbnailImageBitmap,} from 'utils/machineLearning';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';class ReaderService {async getImageBitmap(diff --git a/apps/photos/src/services/machineLearning/ssdMobileNetV2Service.ts b/apps/photos/src/services/machineLearning/ssdMobileNetV2Service.tsindex 9016175ed6..83bb327a16 100644--- a/apps/photos/src/services/machineLearning/ssdMobileNetV2Service.ts+++ b/apps/photos/src/services/machineLearning/ssdMobileNetV2Service.ts@@ -9,7 +9,7 @@ import {import * as SSDMobileNet from '@tensorflow-models/coco-ssd';import { resizeToSquare } from 'utils/image';import { OBJECT_DETECTION_IMAGE_SIZE } from 'constants/mlConfig';-import { addLogLine } from 'utils/logging';+import { addLogLine } from '@ente/shared/logging';class SSDMobileNetV2 implements ObjectDetectionService {private ssdMobileNetV2Model: SSDMobileNet.ObjectDetection;diff --git a/apps/photos/src/services/migrateThumbnailService.ts b/apps/photos/src/services/migrateThumbnailService.tsindex f672a1f9d0..dce5025d0f 100644--- a/apps/photos/src/services/migrateThumbnailService.ts+++ b/apps/photos/src/services/migrateThumbnailService.ts@@ -2,7 +2,7 @@ import downloadManager from 'services/downloadManager';import { getLocalFiles } from 'services/fileService';import { generateThumbnail } from 'services/upload/thumbnailService';import { getToken } from 'utils/common/key';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';import { getEndpoint } from 'utils/common/apiUtil';import HTTPService from 'services/HTTPService';import uploadHttpClient from 'services/upload/uploadHttpClient';diff --git a/apps/photos/src/services/publicCollectionDownloadManager.ts b/apps/photos/src/services/publicCollectionDownloadManager.tsindex a5a19082c4..db77ed314c 100644--- a/apps/photos/src/services/publicCollectionDownloadManager.ts+++ b/apps/photos/src/services/publicCollectionDownloadManager.ts@@ -10,7 +10,7 @@ import {import HTTPService from './HTTPService';import { EnteFile } from 'types/file';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';import { FILE_TYPE } from 'constants/file';import { CustomError } from 'utils/error';import ComlinkCryptoWorker from 'utils/comlink/ComlinkCryptoWorker';diff --git a/apps/photos/src/services/publicCollectionService.ts b/apps/photos/src/services/publicCollectionService.tsindex 79e5427236..947a2663dd 100644--- a/apps/photos/src/services/publicCollectionService.ts+++ b/apps/photos/src/services/publicCollectionService.ts@@ -2,7 +2,7 @@ import { getEndpoint } from 'utils/common/apiUtil';import localForage from 'utils/storage/localForage';import { Collection, CollectionPublicMagicMetadata } from 'types/collection';import HTTPService from './HTTPService';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';import { decryptFile, mergeMetadata, sortFiles } from 'utils/file';import { EncryptedEnteFile, EnteFile } from 'types/file';import {diff --git a/apps/photos/src/services/readerService.ts b/apps/photos/src/services/readerService.tsindex c351225977..816caaa695 100644--- a/apps/photos/src/services/readerService.ts+++ b/apps/photos/src/services/readerService.ts@@ -1,6 +1,6 @@import { ElectronFile } from 'types/upload';import { convertBytesToHumanReadable } from 'utils/file/size';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';export async function getUint8ArrayView(file: Blob | ElectronFilediff --git a/apps/photos/src/services/searchService.ts b/apps/photos/src/services/searchService.tsindex 48c09d4369..6610a5a738 100644--- a/apps/photos/src/services/searchService.ts+++ b/apps/photos/src/services/searchService.ts@@ -6,7 +6,7 @@ import mlIDbStorage from 'utils/storage/mlIDbStorage';import { getMLSyncConfig } from 'utils/machineLearning/config';import { Collection } from 'types/collection';import { EnteFile } from 'types/file';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';import {DateValue,Search,@@ -24,7 +24,7 @@ import { Person, Thing } from 'types/machineLearning';import { getUniqueFiles } from 'utils/file';import { getLatestEntities } from './entityService';import { LocationTag, LocationTagData, EntityType } from 'types/entity';-import { addLogLine } from 'utils/logging';+import { addLogLine } from '@ente/shared/logging';import { FILE_TYPE } from 'constants/file';const DIGITS = new Set(['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']);diff --git a/apps/photos/src/services/trashService.ts b/apps/photos/src/services/trashService.tsindex cff2084e68..ed26156a75 100644--- a/apps/photos/src/services/trashService.ts+++ b/apps/photos/src/services/trashService.ts@@ -3,7 +3,7 @@ import { Collection } from 'types/collection';import { getEndpoint } from 'utils/common/apiUtil';import { getToken } from 'utils/common/key';import { decryptFile, sortTrashFiles } from 'utils/file';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';import localForage from 'utils/storage/localForage';import { getCollection } from './collectionService';diff --git a/apps/photos/src/services/typeDetectionService.ts b/apps/photos/src/services/typeDetectionService.tsindex cade80a7c9..cca8c430a6 100644--- a/apps/photos/src/services/typeDetectionService.ts+++ b/apps/photos/src/services/typeDetectionService.ts@@ -6,7 +6,7 @@ import {} from 'constants/upload';import { CustomError } from 'utils/error';import { getFileExtension } from 'utils/file';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';import { getUint8ArrayView } from './readerService';import FileType, { FileTypeResult } from 'file-type';import { getFileSize } from './upload/fileService';diff --git a/apps/photos/src/services/updateCreationTimeWithExif.ts b/apps/photos/src/services/updateCreationTimeWithExif.tsindex 7c7445f8fe..2c2f1d2d07 100644--- a/apps/photos/src/services/updateCreationTimeWithExif.ts+++ b/apps/photos/src/services/updateCreationTimeWithExif.ts@@ -5,7 +5,7 @@ import {getFileFromURL,updateExistingFilePubMetadata,} from 'utils/file';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';import downloadManager from './downloadManager';import { EnteFile } from 'types/file';diff --git a/apps/photos/src/services/upload/exifService.ts b/apps/photos/src/services/upload/exifService.tsindex 8e191665ba..92e18747bd 100644--- a/apps/photos/src/services/upload/exifService.ts+++ b/apps/photos/src/services/upload/exifService.ts@@ -3,7 +3,7 @@ import { Location } from 'types/upload';import exifr from 'exifr';import piexif from 'piexifjs';import { FileTypeInfo } from 'types/upload';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';import { validateAndGetCreationUnixTimeInMicroSeconds } from 'utils/time';import { CustomError } from 'utils/error';diff --git a/apps/photos/src/services/upload/fileService.ts b/apps/photos/src/services/upload/fileService.tsindex ca3c5dc553..f18e72189c 100644--- a/apps/photos/src/services/upload/fileService.ts+++ b/apps/photos/src/services/upload/fileService.ts@@ -10,8 +10,10 @@ import {ExtractMetadataResult,} from 'types/upload';import { splitFilenameAndExtension } from 'utils/file';-import { logError } from 'utils/sentry';-import { getFileNameSize, addLogLine } from 'utils/logging';+import { logError } from '@ente/shared/sentry';+import { addLogLine } from '@ente/shared/logging';+import { getFileNameSize } from '@ente/shared/logging/web';+import { encryptFiledata } from './encryptionService';import { extractMetadata, getMetadataJSONMapKey } from './metadataService';import {diff --git a/apps/photos/src/services/upload/hashService.tsx b/apps/photos/src/services/upload/hashService.tsxindex 1c943312d1..e351b91e87 100644--- a/apps/photos/src/services/upload/hashService.tsx+++ b/apps/photos/src/services/upload/hashService.tsx@@ -3,8 +3,9 @@ import { FILE_READER_CHUNK_SIZE } from 'constants/upload';import { getFileStream, getElectronFileStream } from 'services/readerService';import { ElectronFile, DataStream } from 'types/upload';import { CustomError } from 'utils/error';-import { addLogLine, getFileNameSize } from 'utils/logging';-import { logError } from 'utils/sentry';+import { addLogLine } from '@ente/shared/logging';+import { getFileNameSize } from '@ente/shared/logging/web';+import { logError } from '@ente/shared/sentry';import { DedicatedCryptoWorker } from 'worker/crypto.worker';export async function getFileHash(diff --git a/apps/photos/src/services/upload/livePhotoService.ts b/apps/photos/src/services/upload/livePhotoService.tsindex 49e62636e6..5c2b237c86 100644--- a/apps/photos/src/services/upload/livePhotoService.ts+++ b/apps/photos/src/services/upload/livePhotoService.ts@@ -18,7 +18,7 @@ import {getFileExtensionWithDot,getFileNameWithoutExtension,} from 'utils/file';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';import { getUint8ArrayView } from '../readerService';import { extractFileMetadata } from './fileService';import { getFileHash } from './hashService';diff --git a/apps/photos/src/services/upload/metadataService.ts b/apps/photos/src/services/upload/metadataService.tsindex 1d99f9a50e..98e419b9b8 100644--- a/apps/photos/src/services/upload/metadataService.ts+++ b/apps/photos/src/services/upload/metadataService.ts@@ -1,5 +1,5 @@import { FILE_TYPE } from 'constants/file';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';import { getEXIFLocation, getEXIFTime, getParsedExifData } from './exifService';import {Metadata,diff --git a/apps/photos/src/services/upload/publicUploadHttpClient.ts b/apps/photos/src/services/upload/publicUploadHttpClient.tsindex 225a329d1f..7bb7cb2a33 100644--- a/apps/photos/src/services/upload/publicUploadHttpClient.ts+++ b/apps/photos/src/services/upload/publicUploadHttpClient.ts@@ -1,6 +1,6 @@import HTTPService from 'services/HTTPService';import { getEndpoint } from 'utils/common/apiUtil';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';import { EnteFile } from 'types/file';import { CustomError, handleUploadError } from 'utils/error';import { UploadFile, UploadURL, MultipartUploadURLs } from 'types/upload';diff --git a/apps/photos/src/services/upload/thumbnailService.ts b/apps/photos/src/services/upload/thumbnailService.tsindex f2c114d214..44ef5bb395 100644--- a/apps/photos/src/services/upload/thumbnailService.ts+++ b/apps/photos/src/services/upload/thumbnailService.ts@@ -1,13 +1,14 @@import { FILE_TYPE } from 'constants/file';import { CustomError, errorWithContext } from 'utils/error';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';import { BLACK_THUMBNAIL_BASE64 } from 'constants/upload';import * as FFmpegService from 'services/ffmpeg/ffmpegService';import ElectronImageProcessorService from 'services/electron/imageProcessor';import { convertBytesToHumanReadable } from 'utils/file/size';import { ElectronFile, FileTypeInfo } from 'types/upload';import { getUint8ArrayView } from '../readerService';-import { getFileNameSize, addLogLine } from 'utils/logging';+import { addLogLine } from '@ente/shared/logging';+import { getFileNameSize } from '@ente/shared/logging/web';import HeicConversionService from 'services/heicConversionService';import { isFileHEIC } from 'utils/file';diff --git a/apps/photos/src/services/upload/uploadHttpClient.ts b/apps/photos/src/services/upload/uploadHttpClient.tsindex 351031ae8a..a436938a66 100644--- a/apps/photos/src/services/upload/uploadHttpClient.ts+++ b/apps/photos/src/services/upload/uploadHttpClient.ts@@ -1,7 +1,7 @@import HTTPService from 'services/HTTPService';import { getEndpoint, getUploadEndpoint } from 'utils/common/apiUtil';import { getToken } from 'utils/common/key';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';import { EnteFile } from 'types/file';import { CustomError, handleUploadError } from 'utils/error';import { UploadFile, UploadURL, MultipartUploadURLs } from 'types/upload';diff --git a/apps/photos/src/services/upload/uploadManager.ts b/apps/photos/src/services/upload/uploadManager.tsindex 7c03bb891f..1f67cd0f01 100644--- a/apps/photos/src/services/upload/uploadManager.ts+++ b/apps/photos/src/services/upload/uploadManager.ts@@ -1,7 +1,7 @@import { getLocalFiles } from '../fileService';import { SetFiles } from 'types/gallery';import { sortFiles, decryptFile, getUserOwnedFiles } from 'utils/file';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';import { getMetadataJSONMapKey, parseMetadataJSON } from './metadataService';import {areFileWithCollectionsSame,@@ -23,7 +23,8 @@ import {import { UPLOAD_RESULT, UPLOAD_STAGES } from 'constants/upload';import uiService from './uiService';-import { addLogLine, getFileNameSize } from 'utils/logging';+import { addLogLine } from '@ente/shared/logging';+import { getFileNameSize } from '@ente/shared/logging/web';import isElectron from 'is-electron';import ImportService from 'services/importService';import watchFolderService from 'services/watchFolder/watchFolderService';diff --git a/apps/photos/src/services/upload/uploadService.ts b/apps/photos/src/services/upload/uploadService.tsindex c50d85dff6..2cb0676569 100644--- a/apps/photos/src/services/upload/uploadService.ts+++ b/apps/photos/src/services/upload/uploadService.ts@@ -1,5 +1,5 @@import { Collection } from 'types/collection';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';import UploadHttpClient from './uploadHttpClient';import { extractFileMetadata, getFilename } from './fileService';import { getFileType } from '../typeDetectionService';diff --git a/apps/photos/src/services/upload/uploader.ts b/apps/photos/src/services/upload/uploader.tsindex 9abc460e5b..b099ee4395 100644--- a/apps/photos/src/services/upload/uploader.ts+++ b/apps/photos/src/services/upload/uploader.ts@@ -1,6 +1,6 @@import { EnteFile } from 'types/file';import { handleUploadError, CustomError } from 'utils/error';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';import { findMatchingExistingFiles } from 'utils/upload';import UIService from './uiService';import UploadService from './uploadService';@@ -13,7 +13,7 @@ import {FileTypeInfo,Logger,} from 'types/upload';-import { addLocalLog, addLogLine } from 'utils/logging';+import { addLocalLog, addLogLine } from '@ente/shared/logging';import { convertBytesToHumanReadable } from 'utils/file/size';import { sleep } from 'utils/common';import { addToCollection } from 'services/collectionService';diff --git a/apps/photos/src/services/upload/videoMetadataService.ts b/apps/photos/src/services/upload/videoMetadataService.tsindex a7c2e2e34b..eec87883f7 100644--- a/apps/photos/src/services/upload/videoMetadataService.ts+++ b/apps/photos/src/services/upload/videoMetadataService.ts@@ -1,8 +1,9 @@import { NULL_EXTRACTED_METADATA } from 'constants/upload';import * as ffmpegService from 'services/ffmpeg/ffmpegService';import { ElectronFile } from 'types/upload';-import { logError } from 'utils/sentry';-import { getFileNameSize, addLogLine } from 'utils/logging';+import { logError } from '@ente/shared/sentry';+import { addLogLine } from '@ente/shared/logging';+import { getFileNameSize } from '@ente/shared/logging/web';export async function getVideoMetadata(file: File | ElectronFile) {let videoMetadata = NULL_EXTRACTED_METADATA;diff --git a/apps/photos/src/services/userService.ts b/apps/photos/src/services/userService.tsindex 0e32d1473b..0b4e074a73 100644--- a/apps/photos/src/services/userService.ts+++ b/apps/photos/src/services/userService.ts@@ -8,7 +8,7 @@ import localForage from 'utils/storage/localForage';import { getToken } from 'utils/common/key';import HTTPService from './HTTPService';import { getRecoveryKey } from 'utils/crypto';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';import {UserDetails,DeleteChallengeResponse,diff --git a/apps/photos/src/services/wasm/ffmpeg.ts b/apps/photos/src/services/wasm/ffmpeg.tsindex 37963652e4..a5b7219f85 100644--- a/apps/photos/src/services/wasm/ffmpeg.ts+++ b/apps/photos/src/services/wasm/ffmpeg.ts@@ -2,8 +2,8 @@ import { createFFmpeg, FFmpeg } from 'ffmpeg-wasm';import QueueProcessor from 'services/queueProcessor';import { getUint8ArrayView } from 'services/readerService';import { promiseWithTimeout } from 'utils/common';-import { addLogLine } from 'utils/logging';-import { logError } from 'utils/sentry';+import { addLogLine } from '@ente/shared/logging';+import { logError } from '@ente/shared/sentry';import { generateTempName } from 'utils/temp';const INPUT_PATH_PLACEHOLDER = 'INPUT';diff --git a/apps/photos/src/services/wasmHeicConverter/wasmHEICConverterService.ts b/apps/photos/src/services/wasmHeicConverter/wasmHEICConverterService.tsindex 3ff88a6fb2..64c8391118 100644--- a/apps/photos/src/services/wasmHeicConverter/wasmHEICConverterService.ts+++ b/apps/photos/src/services/wasmHeicConverter/wasmHEICConverterService.ts@@ -1,8 +1,8 @@import QueueProcessor from 'services/queueProcessor';import { CustomError } from 'utils/error';import { retryAsyncFunction } from 'utils/network';-import { logError } from 'utils/sentry';-import { addLogLine } from 'utils/logging';+import { logError } from '@ente/shared/sentry';+import { addLogLine } from '@ente/shared/logging';import { DedicatedConvertWorker } from 'worker/convert.worker';import { ComlinkWorker } from 'utils/comlink/comlinkWorker';import { convertBytesToHumanReadable } from 'utils/file/size';diff --git a/apps/photos/src/services/watchFolder/watchFolderEventHandlers.ts b/apps/photos/src/services/watchFolder/watchFolderEventHandlers.tsindex bfc462c83d..b0a0f3c1a2 100644--- a/apps/photos/src/services/watchFolder/watchFolderEventHandlers.ts+++ b/apps/photos/src/services/watchFolder/watchFolderEventHandlers.ts@@ -1,7 +1,7 @@import { ElectronFile } from 'types/upload';import { EventQueueItem } from 'types/watchFolder';-import { addLogLine } from 'utils/logging';-import { logError } from 'utils/sentry';+import { addLogLine } from '@ente/shared/logging';+import { logError } from '@ente/shared/sentry';import watchFolderService from './watchFolderService';export async function diskFileAddedCallback(file: ElectronFile) {diff --git a/apps/photos/src/services/watchFolder/watchFolderService.ts b/apps/photos/src/services/watchFolder/watchFolderService.tsindex ba7edbf019..6064bda319 100644--- a/apps/photos/src/services/watchFolder/watchFolderService.ts+++ b/apps/photos/src/services/watchFolder/watchFolderService.ts@@ -3,7 +3,7 @@ import { EncryptedEnteFile } from 'types/file';import { ElectronFile, FileWithCollection } from 'types/upload';import { removeFromCollection } from '../collectionService';import { getLocalFiles } from '../fileService';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';import {EventQueueItem,WatchMapping,@@ -19,7 +19,7 @@ import {import { getParentFolderName } from './utils';import { UPLOAD_RESULT, UPLOAD_STRATEGY } from 'constants/upload';import uploadManager from 'services/upload/uploadManager';-import { addLocalLog, addLogLine } from 'utils/logging';+import { addLocalLog, addLogLine } from '@ente/shared/logging';import { getValidFilesToUpload } from 'utils/watch';import { groupFilesBasedOnCollectionID } from 'utils/file';diff --git a/apps/photos/src/utils/billing/index.ts b/apps/photos/src/utils/billing/index.tsindex cf70470aff..30373da299 100644--- a/apps/photos/src/utils/billing/index.ts+++ b/apps/photos/src/utils/billing/index.ts@@ -5,7 +5,7 @@ import { Plan, Subscription } from 'types/billing';import { NextRouter } from 'next/router';import { SetLoading } from 'types/gallery';import { getData, LS_KEYS } from '../storage/localStorage';-import { logError } from '../sentry';+import { logError } from '@ente/shared/sentry';import { SetDialogBoxAttributes } from 'types/dialogBox';import { openLink } from 'utils/common';import { isPartOfFamily, getTotalFamilyUsage } from 'utils/user/family';diff --git a/apps/photos/src/utils/collection/index.ts b/apps/photos/src/utils/collection/index.tsindex 36b85d5636..27b705c41e 100644--- a/apps/photos/src/utils/collection/index.ts+++ b/apps/photos/src/utils/collection/index.ts@@ -18,7 +18,7 @@ import { EnteFile } from 'types/file';import { CustomError } from 'utils/error';import { User } from 'types/user';import { getData, LS_KEYS } from 'utils/storage/localStorage';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';import {COLLECTION_ROLE,Collection,diff --git a/apps/photos/src/utils/comlink/comlinkWorker.ts b/apps/photos/src/utils/comlink/comlinkWorker.tsindex b2a43335de..7b49358005 100644--- a/apps/photos/src/utils/comlink/comlinkWorker.ts+++ b/apps/photos/src/utils/comlink/comlinkWorker.ts@@ -1,6 +1,6 @@import { expose, Remote, wrap } from 'comlink';import { WorkerElectronCacheStorageClient } from 'services/workerElectronCache/client';-import { addLocalLog } from 'utils/logging';+import { addLocalLog } from '@ente/shared/logging';export class ComlinkWorker<T extends new () => InstanceType<T>> {public remote: Promise<Remote<InstanceType<T>>>;diff --git a/apps/photos/src/utils/common/job.ts b/apps/photos/src/utils/common/job.tsindex 01784095b1..f0515fbde6 100644--- a/apps/photos/src/utils/common/job.ts+++ b/apps/photos/src/utils/common/job.ts@@ -1,5 +1,5 @@import { JobResult, JobConfig, JobState } from 'types/common/job';-import { addLogLine } from 'utils/logging';+import { addLogLine } from '@ente/shared/logging';export class SimpleJob<R extends JobResult> {private config: JobConfig;diff --git a/apps/photos/src/utils/crypto/index.ts b/apps/photos/src/utils/crypto/index.tsindex 9bb3da3036..c816bd93be 100644--- a/apps/photos/src/utils/crypto/index.ts+++ b/apps/photos/src/utils/crypto/index.ts@@ -3,7 +3,7 @@ import { SESSION_KEYS, setKey } from 'utils/storage/sessionStorage';import { getData, LS_KEYS, setData } from 'utils/storage/localStorage';import { getActualKey, getToken } from 'utils/common/key';import { setRecoveryKey } from '@ente/accounts/api/user';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';import isElectron from 'is-electron';import safeStorageService from 'services/electron/safeStorage';import ComlinkCryptoWorker from 'utils/comlink/ComlinkCryptoWorker';@@ -12,7 +12,7 @@ import zxcvbn from 'zxcvbn';import { SRP, SrpClient } from 'fast-srp-hap';import { convertBase64ToBuffer, convertBufferToBase64 } from 'utils/user';import { v4 as uuidv4 } from 'uuid';-import { addLocalLog } from 'utils/logging';+import { addLocalLog } from '@ente/shared/logging';const SRP_PARAMS = SRP.params['4096'];diff --git a/apps/photos/src/utils/file/index.ts b/apps/photos/src/utils/file/index.tsindex ba192a1e18..1812a01f78 100644--- a/apps/photos/src/utils/file/index.ts+++ b/apps/photos/src/utils/file/index.ts@@ -11,7 +11,7 @@ import {import { decodeLivePhoto } from 'services/livePhotoService';import { getFileType } from 'services/typeDetectionService';import DownloadManager from 'services/downloadManager';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';import { User } from 'types/user';import { getData, LS_KEYS } from 'utils/storage/localStorage';import { updateFileCreationDateInEXIF } from 'services/upload/exifService';@@ -30,7 +30,7 @@ import * as ffmpegService from 'services/ffmpeg/ffmpegService';import { VISIBILITY_STATE } from 'types/magicMetadata';import { isArchivedFile, updateMagicMetadata } from 'utils/magicMetadata';-import { addLocalLog, addLogLine } from 'utils/logging';+import { addLocalLog, addLogLine } from '@ente/shared/logging';import { CustomError } from 'utils/error';import { convertBytesToHumanReadable } from './size';import ComlinkCryptoWorker from 'utils/comlink/ComlinkCryptoWorker';diff --git a/apps/photos/src/utils/logging/index.ts b/apps/photos/src/utils/logging/index.tsdeleted file mode 100644index a949d9f32a..0000000000--- a/apps/photos/src/utils/logging/index.ts+++ /dev/null@@ -1,116 +0,0 @@-import { ElectronFile } from 'types/upload';-import { convertBytesToHumanReadable } from 'utils/file/size';-import { formatDateTimeShort } from 'utils/time/format';-import { isDEVSentryENV } from 'constants/sentry';-import isElectron from 'is-electron';-import ElectronService from 'services/electron/common';-import { logError } from 'utils/sentry';-import {- getData,- LS_KEYS,- removeData,- setData,-} from 'utils/storage/localStorage';--export const MAX_LOG_SIZE = 5 * 1024 * 1024; // 5MB-export const MAX_LOG_LINES = 1000;--export interface Log {- timestamp: number;- logLine: string;-}--export function addLogLine(- log: string | number | boolean,- ...optionalParams: (string | number | boolean)[]-) {- try {- const completeLog = [log, ...optionalParams].join(' ');- if (isDEVSentryENV()) {- console.log(completeLog);- }-- if (isElectron()) {- ElectronService.logToDisk(completeLog);- } else {- saveLogLine({- timestamp: Date.now(),- logLine: completeLog,- });- }- } catch (e) {- if (e.name === 'QuotaExceededError') {- deleteLogs();- addLogLine('logs cleared');- }- logError(e, 'failed to addLogLine', undefined, true);- // ignore- }-}--export const addLocalLog = (getLog: () => string) => {- if (isDEVSentryENV()) {- console.log(getLog());- }-};--export function getDebugLogs() {- return combineLogLines(getLogs());-}--export function getFileNameSize(file: File | ElectronFile) {- return `${file.name}_${convertBytesToHumanReadable(file.size)}`;-}--export const clearLogsIfLocalStorageLimitExceeded = () => {- try {- const logs = getDebugLogs();- const logSize = getStringSize(logs);- if (logSize > MAX_LOG_SIZE) {- deleteLogs();- addLogLine('Logs cleared due to size limit exceeded');- } else {- try {- addLogLine(`app started`);- } catch (e) {- deleteLogs();- }- }- addLogLine(`logs size: ${convertBytesToHumanReadable(logSize)}`);- } catch (e) {- logError(e, 'failed to clearLogsIfLocalStorageLimitExceeded');- }-};--function saveLogLine(log: Log) {- const logs = getLogs();- if (logs.length > MAX_LOG_LINES) {- logs.slice(logs.length - MAX_LOG_LINES);- }- logs.push(log);- setLogs(logs);-}--function getLogs(): Log[] {- return getData(LS_KEYS.LOGS)?.logs ?? [];-}--function setLogs(logs: Log[]) {- setData(LS_KEYS.LOGS, { logs });-}--function deleteLogs() {- removeData(LS_KEYS.LOGS);-}--function getStringSize(str: string) {- return new Blob([str]).size;-}--function formatLog(log: Log) {- return `[${formatDateTimeShort(log.timestamp)}] ${log.logLine}`;-}--function combineLogLines(logs: Log[]) {- return logs.map(formatLog).join('\n');-}diff --git a/apps/photos/src/utils/machineLearning/clustering.ts b/apps/photos/src/utils/machineLearning/clustering.tsindex 8a9b9252e0..9abd971d24 100644--- a/apps/photos/src/utils/machineLearning/clustering.ts+++ b/apps/photos/src/utils/machineLearning/clustering.ts@@ -12,7 +12,7 @@ import {MLSyncContext,NearestCluster,} from 'types/machineLearning';-import { addLogLine } from 'utils/logging';+import { addLogLine } from '@ente/shared/logging';// import { getAllFacesMap } from 'utils/storage/mlStorage';// export function getClusterSummary(cluster: Cluster): FaceDescriptor {diff --git a/apps/photos/src/utils/machineLearning/compatibility.ts b/apps/photos/src/utils/machineLearning/compatibility.tsindex ead2237e8f..8835dd4dca 100644--- a/apps/photos/src/utils/machineLearning/compatibility.ts+++ b/apps/photos/src/utils/machineLearning/compatibility.ts@@ -5,7 +5,7 @@ import {} from 'utils/common';import isElectron from 'is-electron';-import { addLogLine } from 'utils/logging';+import { addLogLine } from '@ente/shared/logging';export function canEnableMlSearch(): boolean {// check if is chrome or ente desktopdiff --git a/apps/photos/src/utils/machineLearning/faceCrop.ts b/apps/photos/src/utils/machineLearning/faceCrop.tsindex f242bcd4e3..c9217e9f13 100644--- a/apps/photos/src/utils/machineLearning/faceCrop.ts+++ b/apps/photos/src/utils/machineLearning/faceCrop.ts@@ -12,7 +12,7 @@ import {FaceDetection,} from 'types/machineLearning';import { cropWithRotation, imageBitmapToBlob } from 'utils/image';-import { addLogLine } from 'utils/logging';+import { addLogLine } from '@ente/shared/logging';import { getBlobFromCache } from 'utils/storage/cache';import { enlargeBox } from '.';import { Box } from '../../../thirdparty/face-api/classes';diff --git a/apps/photos/src/utils/machineLearning/index.ts b/apps/photos/src/utils/machineLearning/index.tsindex ce84e1e1cb..e63f266518 100644--- a/apps/photos/src/utils/machineLearning/index.ts+++ b/apps/photos/src/utils/machineLearning/index.ts@@ -39,7 +39,7 @@ import {import { CACHES } from 'constants/cache';import { FILE_TYPE } from 'constants/file';import { decodeLivePhoto } from 'services/livePhotoService';-import { addLogLine } from 'utils/logging';+import { addLogLine } from '@ente/shared/logging';import { Remote } from 'comlink';import { DedicatedCryptoWorker } from 'worker/crypto.worker';diff --git a/apps/photos/src/utils/machineLearning/migrations.ts b/apps/photos/src/utils/machineLearning/migrations.tsindex f02848d717..af0629b6d7 100644--- a/apps/photos/src/utils/machineLearning/migrations.ts+++ b/apps/photos/src/utils/machineLearning/migrations.ts@@ -1,5 +1,5 @@import { MlFileData, Face } from 'types/machineLearning';-import { addLogLine } from 'utils/logging';+import { addLogLine } from '@ente/shared/logging';import mlIDbStorage from 'utils/storage/mlIDbStorage';import { mlFilesStore } from 'utils/storage/mlStorage';import { getFaceId } from '.';diff --git a/apps/photos/src/utils/machineLearning/mldataExport.ts b/apps/photos/src/utils/machineLearning/mldataExport.tsindex 6877ac97bd..ba01f5ebe9 100644--- a/apps/photos/src/utils/machineLearning/mldataExport.ts+++ b/apps/photos/src/utils/machineLearning/mldataExport.ts@@ -3,7 +3,7 @@ import mlIDbStorage from 'utils/storage/mlIDbStorage';import * as zip from '@zip.js/zip.js';import { CACHES } from 'constants/cache';import { CacheStorageService } from 'services/cache/cacheStorageService';-import { addLogLine } from 'utils/logging';+import { addLogLine } from '@ente/shared/logging';class FileSystemWriter extends zip.Writer {writableStream: FileSystemWritableFileStream;diff --git a/apps/photos/src/utils/photoFrame/index.ts b/apps/photos/src/utils/photoFrame/index.tsindex 168f90f6e1..7637898f92 100644--- a/apps/photos/src/utils/photoFrame/index.ts+++ b/apps/photos/src/utils/photoFrame/index.ts@@ -1,7 +1,7 @@import { FILE_TYPE } from 'constants/file';import { EnteFile } from 'types/file';import { MergedSourceURL } from 'types/gallery';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';const WAIT_FOR_VIDEO_PLAYBACK = 1 * 1000;diff --git a/apps/photos/src/utils/sentry/index.ts b/apps/photos/src/utils/sentry/index.tsdeleted file mode 100644index 43e2a472f0..0000000000--- a/apps/photos/src/utils/sentry/index.ts+++ /dev/null@@ -1,75 +0,0 @@-import * as Sentry from '@sentry/nextjs';-import { addLocalLog, addLogLine } from 'utils/logging';-import { getSentryUserID } from 'utils/user';-import InMemoryStore, { MS_KEYS } from 'services/InMemoryStore';-import { getHasOptedOutOfCrashReports } from 'utils/storage';-import { ApiError } from 'utils/error';--export const logError = async (- error: any,- msg: string,- info?: Record<string, unknown>,- skipAddLogLine = false-) => {- const err = errorWithContext(error, msg);- if (!skipAddLogLine) {- if (error instanceof ApiError) {- addLogLine(`error: ${error?.name} ${error?.message}- msg: ${msg} errorCode: ${JSON.stringify(error?.errCode)}- httpStatusCode: ${JSON.stringify(error?.httpStatusCode)} ${- info ? `info: ${JSON.stringify(info)}` : ''- }- ${error?.stack}`);- } else {- addLogLine(- `error: ${error?.name} ${error?.message}- msg: ${msg} ${info ? `info: ${JSON.stringify(info)}` : ''}- ${error?.stack}`- );- }- }- if (!InMemoryStore.has(MS_KEYS.OPT_OUT_OF_CRASH_REPORTS)) {- const optedOutOfCrashReports = getHasOptedOutOfCrashReports();- InMemoryStore.set(- MS_KEYS.OPT_OUT_OF_CRASH_REPORTS,- optedOutOfCrashReports- );- }- if (InMemoryStore.get(MS_KEYS.OPT_OUT_OF_CRASH_REPORTS)) {- addLocalLog(() => `skipping sentry error: ${error?.name}`);- return;- }- if (isErrorUnnecessaryForSentry(error)) {- return;- }-- Sentry.captureException(err, {- level: 'info',- user: { id: await getSentryUserID() },- contexts: {- ...(info && {- info: info,- }),- rootCause: { message: error?.message, completeError: error },- },- });-};--// copy of errorWithContext to prevent importing error util-function errorWithContext(originalError: Error, context: string) {- const errorWithContext = new Error(context);- errorWithContext.stack =- errorWithContext.stack.split('\n').slice(2, 4).join('\n') +- '\n' +- originalError.stack;- return errorWithContext;-}--function isErrorUnnecessaryForSentry(error: any) {- if (error?.message?.includes('Network Error')) {- return true;- } else if (error?.status === 401) {- return true;- }- return false;-}diff --git a/apps/photos/src/utils/storage/cache.ts b/apps/photos/src/utils/storage/cache.tsindex 1bf2746639..7894e07757 100644--- a/apps/photos/src/utils/storage/cache.ts+++ b/apps/photos/src/utils/storage/cache.ts@@ -1,6 +1,6 @@import { CACHES } from 'constants/cache';import { CacheStorageService } from 'services/cache/cacheStorageService';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';export async function cached(cacheName: string,diff --git a/apps/photos/src/utils/storage/localStorage.ts b/apps/photos/src/utils/storage/localStorage.tsindex 1c1ce575ca..3d807d05cc 100644--- a/apps/photos/src/utils/storage/localStorage.ts+++ b/apps/photos/src/utils/storage/localStorage.ts@@ -1,4 +1,4 @@-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';export enum LS_KEYS {USER = 'user',diff --git a/apps/photos/src/utils/storage/mlIDbStorage.ts b/apps/photos/src/utils/storage/mlIDbStorage.tsindex 2abdd5d241..1bfb660386 100644--- a/apps/photos/src/utils/storage/mlIDbStorage.ts+++ b/apps/photos/src/utils/storage/mlIDbStorage.ts@@ -23,8 +23,8 @@ import {} from 'types/machineLearning';import { IndexStatus } from 'types/machineLearning/ui';import { runningInBrowser, runningInElectron } from 'utils/common';-import { addLogLine } from 'utils/logging';-import { logError } from 'utils/sentry';+import { addLogLine } from '@ente/shared/logging';+import { logError } from '@ente/shared/sentry';export const ML_SYNC_JOB_CONFIG_NAME = 'ml-sync-job';export const ML_SYNC_CONFIG_NAME = 'ml-sync';diff --git a/apps/photos/src/utils/user/family.ts b/apps/photos/src/utils/user/family.tsindex 95f51eeea7..c02ee2d30a 100644--- a/apps/photos/src/utils/user/family.ts+++ b/apps/photos/src/utils/user/family.ts@@ -1,5 +1,5 @@import { FamilyData, FamilyMember, User } from 'types/user';-import { logError } from 'utils/sentry';+import { logError } from '@ente/shared/sentry';import { getData, LS_KEYS } from 'utils/storage/localStorage';export function getLocalFamilyData(): FamilyData {diff --git a/apps/photos/src/worker/ml.worker.ts b/apps/photos/src/worker/ml.worker.tsindex dc94ed3b67..bfec0488e7 100644--- a/apps/photos/src/worker/ml.worker.ts+++ b/apps/photos/src/worker/ml.worker.ts@@ -2,7 +2,7 @@ import { expose } from 'comlink';import { EnteFile } from 'types/file';import mlService from 'services/machineLearning/machineLearningService';import { MachineLearningWorker } from 'types/machineLearning';-import { addLogLine } from 'utils/logging';+import { addLogLine } from '@ente/shared/logging';// import ReverseProxiedElectronCacheStorageProxy from './electronCacheStorageProxy.proxy';// import { setupResponseComlinkTransferHandler } from 'utils/comlink';diff --git a/apps/photos/tests/zip-file-reading.test.ts b/apps/photos/tests/zip-file-reading.test.tsindex 6d0ffffc2b..2e088fd791 100644--- a/apps/photos/tests/zip-file-reading.test.ts+++ b/apps/photos/tests/zip-file-reading.test.ts@@ -2,7 +2,7 @@ import { DataStream } from 'types/upload';import ImportService from 'services/importService';import { FILE_READER_CHUNK_SIZE, PICKED_UPLOAD_TYPE } from 'constants/upload';import { getFileStream, getElectronFileStream } from 'services/readerService';-import { getFileNameSize } from 'utils/logging';+import { getFileNameSize } from '@ente/shared/logging/web';import isElectron from 'is-electron';import { getImportSuggestion } from 'utils/upload';diff --git a/packages/shared/logging/web.ts b/packages/shared/logging/web.tsindex 1b75aa7c12..5a58a8ee8d 100644--- a/packages/shared/logging/web.ts+++ b/packages/shared/logging/web.ts@@ -7,6 +7,7 @@ import {removeData,setData,} from '@ente/shared/storage/localStorage';+import { ElectronFile } from '../upload/types';export const MAX_LOG_SIZE = 5 * 1024 * 1024; // 5MBexport const MAX_LOG_LINES = 1000;@@ -37,6 +38,10 @@ export function getDebugLogs() {return combineLogLines(getLogs());}+export function getFileNameSize(file: File | ElectronFile) {+ return `${file.name}_${convertBytesToHumanReadable(file.size)}`;+}+export const clearLogsIfLocalStorageLimitExceeded = () => {try {const logs = getDebugLogs();diff --git a/packages/shared/upload/types.ts b/packages/shared/upload/types.tsindex e69de29bb2..d6f298491e 100644--- a/packages/shared/upload/types.ts+++ b/packages/shared/upload/types.ts@@ -0,0 +1,17 @@+/*+ * ElectronFile is a custom interface that is used to represent+ * any file on disk as a File-like object in the Electron desktop app.+ *+ * This was added to support the auto-resuming of failed uploads+ * which needed absolute paths to the files which the+ * normal File interface does not provide.+ */+export interface ElectronFile {+ name: string;+ path: string;+ size: number;+ lastModified: number;+ stream: () => Promise<ReadableStream<Uint8Array>>;+ blob: () => Promise<Blob>;+ arrayBuffer: () => Promise<Uint8Array>;+}