use convertBytesToHumanReadable for logging
This commit is contained in:
parent
4d868ffe5c
commit
afa9ba0521
|
@ -1,6 +1,6 @@
|
||||||
import { ElectronAPIs } from 'types/electron';
|
import { ElectronAPIs } from 'types/electron';
|
||||||
import { ElectronFile } from 'types/upload';
|
import { ElectronFile } from 'types/upload';
|
||||||
import { makeHumanReadableStorage } from 'utils/billing';
|
import { convertBytesToHumanReadable } from 'utils/file/size';
|
||||||
import { addLogLine } from 'utils/logging';
|
import { addLogLine } from 'utils/logging';
|
||||||
import { logError } from 'utils/sentry';
|
import { logError } from 'utils/sentry';
|
||||||
|
|
||||||
|
@ -29,9 +29,9 @@ class ElectronImageProcessorService {
|
||||||
inputFileData
|
inputFileData
|
||||||
);
|
);
|
||||||
addLogLine(
|
addLogLine(
|
||||||
`originalFileSize:${makeHumanReadableStorage(
|
`originalFileSize:${convertBytesToHumanReadable(
|
||||||
fileBlob?.size
|
fileBlob?.size
|
||||||
)},convertedFileSize:${makeHumanReadableStorage(
|
)},convertedFileSize:${convertBytesToHumanReadable(
|
||||||
convertedFileData?.length
|
convertedFileData?.length
|
||||||
)}, native heic conversion time: ${Date.now() - startTime}ms `
|
)}, native heic conversion time: ${Date.now() - startTime}ms `
|
||||||
);
|
);
|
||||||
|
@ -58,9 +58,9 @@ class ElectronImageProcessorService {
|
||||||
maxSize
|
maxSize
|
||||||
);
|
);
|
||||||
addLogLine(
|
addLogLine(
|
||||||
`originalFileSize:${makeHumanReadableStorage(
|
`originalFileSize:${convertBytesToHumanReadable(
|
||||||
inputFile?.size
|
inputFile?.size
|
||||||
)},thumbFileSize:${makeHumanReadableStorage(
|
)},thumbFileSize:${convertBytesToHumanReadable(
|
||||||
thumb?.length
|
thumb?.length
|
||||||
)}, native thumbnail generation time: ${
|
)}, native thumbnail generation time: ${
|
||||||
Date.now() - startTime
|
Date.now() - startTime
|
||||||
|
|
|
@ -3,10 +3,10 @@ import { CustomError } from 'utils/error';
|
||||||
import { retryAsyncFunction } from 'utils/network';
|
import { retryAsyncFunction } from 'utils/network';
|
||||||
import { logError } from 'utils/sentry';
|
import { logError } from 'utils/sentry';
|
||||||
import { addLogLine } from 'utils/logging';
|
import { addLogLine } from 'utils/logging';
|
||||||
import { makeHumanReadableStorage } from 'utils/billing';
|
|
||||||
import { DedicatedConvertWorker } from 'worker/convert.worker';
|
import { DedicatedConvertWorker } from 'worker/convert.worker';
|
||||||
import { ComlinkWorker } from 'utils/comlink/comlinkWorker';
|
import { ComlinkWorker } from 'utils/comlink/comlinkWorker';
|
||||||
import { getDedicatedConvertWorker } from 'utils/comlink';
|
import { getDedicatedConvertWorker } from 'utils/comlink';
|
||||||
|
import { convertBytesToHumanReadable } from 'utils/file/size';
|
||||||
|
|
||||||
const WORKER_POOL_SIZE = 2;
|
const WORKER_POOL_SIZE = 2;
|
||||||
const MAX_CONVERSION_IN_PARALLEL = 1;
|
const MAX_CONVERSION_IN_PARALLEL = 1;
|
||||||
|
@ -52,9 +52,9 @@ class HEICConverter {
|
||||||
CONVERT_FORMAT
|
CONVERT_FORMAT
|
||||||
);
|
);
|
||||||
addLogLine(
|
addLogLine(
|
||||||
`originalFileSize:${makeHumanReadableStorage(
|
`originalFileSize:${convertBytesToHumanReadable(
|
||||||
fileBlob?.size
|
fileBlob?.size
|
||||||
)},convertedFileSize:${makeHumanReadableStorage(
|
)},convertedFileSize:${convertBytesToHumanReadable(
|
||||||
convertedHEIC?.size
|
convertedHEIC?.size
|
||||||
)}, heic conversion time: ${
|
)}, heic conversion time: ${
|
||||||
Date.now() - startTime
|
Date.now() - startTime
|
||||||
|
@ -74,10 +74,10 @@ class HEICConverter {
|
||||||
Error(`converted heic fileSize is Zero`),
|
Error(`converted heic fileSize is Zero`),
|
||||||
'converted heic fileSize is Zero',
|
'converted heic fileSize is Zero',
|
||||||
{
|
{
|
||||||
originalFileSize: makeHumanReadableStorage(
|
originalFileSize: convertBytesToHumanReadable(
|
||||||
fileBlob?.size ?? 0
|
fileBlob?.size ?? 0
|
||||||
),
|
),
|
||||||
convertedFileSize: makeHumanReadableStorage(
|
convertedFileSize: convertBytesToHumanReadable(
|
||||||
convertedHEIC?.size ?? 0
|
convertedHEIC?.size ?? 0
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,8 +29,8 @@ import {
|
||||||
import { IsArchived, updateMagicMetadataProps } from 'utils/magicMetadata';
|
import { IsArchived, updateMagicMetadataProps } from 'utils/magicMetadata';
|
||||||
|
|
||||||
import { addLogLine } from 'utils/logging';
|
import { addLogLine } from 'utils/logging';
|
||||||
import { makeHumanReadableStorage } from 'utils/billing';
|
|
||||||
import { CustomError } from 'utils/error';
|
import { CustomError } from 'utils/error';
|
||||||
|
import { convertBytesToHumanReadable } from './size';
|
||||||
|
|
||||||
const WAIT_TIME_IMAGE_CONVERSION = 30 * 1000;
|
const WAIT_TIME_IMAGE_CONVERSION = 30 * 1000;
|
||||||
|
|
||||||
|
@ -352,7 +352,7 @@ async function getPlayableVideo(videoNameTitle: string, video: Uint8Array) {
|
||||||
async function getRenderableImage(fileName: string, imageBlob: Blob) {
|
async function getRenderableImage(fileName: string, imageBlob: Blob) {
|
||||||
if (await isFileHEIC(imageBlob, fileName)) {
|
if (await isFileHEIC(imageBlob, fileName)) {
|
||||||
addLogLine(
|
addLogLine(
|
||||||
`HEICConverter called for ${fileName}-${makeHumanReadableStorage(
|
`HEICConverter called for ${fileName}-${convertBytesToHumanReadable(
|
||||||
imageBlob.size
|
imageBlob.size
|
||||||
)}`
|
)}`
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue