From 1cd1d2644161929a61674a844c9aaab655415582 Mon Sep 17 00:00:00 2001 From: TGS963 Date: Sun, 30 Apr 2023 15:52:43 +0530 Subject: [PATCH] added some logging --- renderer/components/SettingsTab.tsx | 4 ++++ renderer/pages/index.tsx | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/renderer/components/SettingsTab.tsx b/renderer/components/SettingsTab.tsx index 5a76504..b0ecfbd 100644 --- a/renderer/components/SettingsTab.tsx +++ b/renderer/components/SettingsTab.tsx @@ -4,6 +4,7 @@ import commands from "../../electron/commands"; import { useAtom } from "jotai"; import { customModelsPathAtom, scaleAtom } from "../atoms/userSettingsAtom"; import { modelsListAtom } from "../atoms/modelsListAtom"; +import useLog from "./hooks/useLog"; interface IProps { batchMode: boolean; @@ -42,6 +43,8 @@ function SettingsTab({ const [rememberOutputFolder, setRememberOutputFolder] = useState(false); + const { logit } = useLog(); + useEffect(() => { themeChange(false); @@ -99,6 +102,7 @@ function SettingsTab({ }; const handleGpuIdChange = (e) => { + logit("New GPU ID: ", e.target.value); setGpuId(e.target.value); localStorage.setItem("gpuId", e.target.value); }; diff --git a/renderer/pages/index.tsx b/renderer/pages/index.tsx index 860e936..de213f1 100644 --- a/renderer/pages/index.tsx +++ b/renderer/pages/index.tsx @@ -62,8 +62,11 @@ const Home = () => { setLoaded(true); setVersion(navigator?.userAgent?.match(/Upscayl\/([\d\.]+\d+)/)[1]); + logit(`version: ${version}`); const handleErrors = (data: string) => { + logit(`Error: ${data}`); + if (data.includes("invalid gpu")) { alert( "Error. Please make sure you have a Vulkan compatible GPU (Most modern GPUs support Vulkan). Upscayl does not work with CPU or iGPU sadly." @@ -142,6 +145,7 @@ const Home = () => { window.electron.on(commands.FOLDER_UPSCAYL_DONE, (_, data: string) => { setProgress(""); setUpscaledBatchFolderPath(data); + logit("upscaledBatchFolderPath: ", upscaledBatchFolderPath); logit(data); }); @@ -150,6 +154,7 @@ const Home = () => { setProgress(""); setDoubleUpscaylCounter(0); setUpscaledImagePath(data); + logit("upscaledImagePath: ", upscaledImagePath); logit(data); }); @@ -157,6 +162,7 @@ const Home = () => { window.electron.on(commands.UPSCAYL_VIDEO_DONE, (_, data: string) => { setProgress(""); setUpscaledVideoPath(data); + logit("upscaledVideoPath: ", upscaledVideoPath); logit(data); }); @@ -197,6 +203,9 @@ const Home = () => { const rememberOutputFolder = localStorage.getItem("rememberOutputFolder"); const lastOutputFolderPath = localStorage.getItem("lastOutputFolderPath"); + logit("localStorage (rememberOutputFolder): ", rememberOutputFolder); + logit("localStorage (lastOutputFolderPath): ", lastOutputFolderPath); + if (rememberOutputFolder === "true") { setOutputPath(lastOutputFolderPath); } else { @@ -217,11 +226,20 @@ const Home = () => { filePath ); + logit( + "filePath: ", + filePath + ); + const extension = imagePath.toLocaleLowerCase().split(".").pop(); console.log( "🚀 => file: index.jsx => line 111 => useEffect => extension", extension ); + logit( + "extension: ", + extension + ); if (!allowedFileTypes.includes(extension.toLowerCase())) { alert("Please select an image");