1
0
mirror of https://github.com/upscayl/upscayl.git synced 2025-01-31 04:03:51 +01:00

Added logit on renderer

This commit is contained in:
Feenix 2023-04-30 07:14:47 +05:30
parent b1db755843
commit be1eb62a91

View File

@ -13,6 +13,7 @@ import { useAtom } from "jotai";
import { logAtom } from "../atoms/logAtom"; import { logAtom } from "../atoms/logAtom";
import { modelsListAtom } from "../atoms/modelsListAtom"; import { modelsListAtom } from "../atoms/modelsListAtom";
import { batchModeAtom, scaleAtom } from "../atoms/userSettingsAtom"; import { batchModeAtom, scaleAtom } from "../atoms/userSettingsAtom";
import useLog from "../components/hooks/useLog";
const Home = () => { const Home = () => {
// STATES // STATES
@ -45,6 +46,8 @@ const Home = () => {
const [modelOptions, setModelOptions] = useAtom(modelsListAtom); const [modelOptions, setModelOptions] = useAtom(modelsListAtom);
const [scale] = useAtom(scaleAtom); const [scale] = useAtom(scaleAtom);
const { logit } = useLog();
// (function () { // (function () {
// let info = console.info; // let info = console.info;
@ -54,11 +57,6 @@ const Home = () => {
// }; // };
// })(); // })();
const addToLog = (data: string) => {
console.log("🚀 => file: index.tsx:52 => data:", data);
setLogData((prevLogData) => [...prevLogData, data]);
};
// EFFECTS // EFFECTS
useEffect(() => { useEffect(() => {
setLoaded(true); setLoaded(true);
@ -90,7 +88,7 @@ const Home = () => {
// LOG // LOG
window.electron.on(commands.LOG, (_, data: string) => { window.electron.on(commands.LOG, (_, data: string) => {
addToLog(data); logit(data);
}); });
// UPSCAYL PROGRESS // UPSCAYL PROGRESS
@ -99,7 +97,7 @@ const Home = () => {
setProgress(data); setProgress(data);
} }
handleErrors(data); handleErrors(data);
addToLog(data); logit(data);
}); });
// FOLDER UPSCAYL PROGRESS // FOLDER UPSCAYL PROGRESS
@ -108,7 +106,7 @@ const Home = () => {
setProgress(data); setProgress(data);
} }
handleErrors(data); handleErrors(data);
addToLog(data); logit(data);
}); });
// DOUBLE UPSCAYL PROGRESS // DOUBLE UPSCAYL PROGRESS
@ -120,7 +118,7 @@ const Home = () => {
setProgress(data); setProgress(data);
} }
handleErrors(data); handleErrors(data);
addToLog(data); logit(data);
}); });
// VIDEO UPSCAYL PROGRESS // VIDEO UPSCAYL PROGRESS
@ -129,22 +127,22 @@ const Home = () => {
setProgress(data); setProgress(data);
} }
handleErrors(data); handleErrors(data);
addToLog(data); logit(data);
}); });
// UPSCAYL DONE // UPSCAYL DONE
window.electron.on(commands.UPSCAYL_DONE, (_, data: string) => { window.electron.on(commands.UPSCAYL_DONE, (_, data: string) => {
setProgress(""); setProgress("");
setUpscaledImagePath(data); setUpscaledImagePath(data);
console.log("upscaledImagePath: ", upscaledImagePath); logit("upscaledImagePath: ", upscaledImagePath);
addToLog(data); logit(data);
}); });
// FOLDER UPSCAYL DONE // FOLDER UPSCAYL DONE
window.electron.on(commands.FOLDER_UPSCAYL_DONE, (_, data: string) => { window.electron.on(commands.FOLDER_UPSCAYL_DONE, (_, data: string) => {
setProgress(""); setProgress("");
setUpscaledBatchFolderPath(data); setUpscaledBatchFolderPath(data);
addToLog(data); logit(data);
}); });
// DOUBLE UPSCAYL DONE // DOUBLE UPSCAYL DONE
@ -152,14 +150,14 @@ const Home = () => {
setProgress(""); setProgress("");
setDoubleUpscaylCounter(0); setDoubleUpscaylCounter(0);
setUpscaledImagePath(data); setUpscaledImagePath(data);
addToLog(data); logit(data);
}); });
// VIDEO UPSCAYL DONE // VIDEO UPSCAYL DONE
window.electron.on(commands.UPSCAYL_VIDEO_DONE, (_, data: string) => { window.electron.on(commands.UPSCAYL_VIDEO_DONE, (_, data: string) => {
setProgress(""); setProgress("");
setUpscaledVideoPath(data); setUpscaledVideoPath(data);
addToLog(data); logit(data);
}); });
// CUSTOM FOLDER LISTENER // CUSTOM FOLDER LISTENER