1
0
mirror of https://github.com/upscayl/upscayl.git synced 2024-11-23 23:21:05 +01:00

added some logging

This commit is contained in:
TGS963 2023-04-30 15:52:43 +05:30
parent be1eb62a91
commit 1cd1d26441
2 changed files with 22 additions and 0 deletions

View File

@ -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);
};

View File

@ -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");