mirror of
https://github.com/upscayl/upscayl.git
synced 2025-02-17 11:18:36 +01:00
Added useLog hook
This commit is contained in:
parent
08bc58bce0
commit
b1db755843
21
renderer/components/hooks/useLog.tsx
Normal file
21
renderer/components/hooks/useLog.tsx
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import { logAtom } from "../../atoms/logAtom";
|
||||||
|
import log from "electron-log/renderer";
|
||||||
|
import { useSetAtom } from "jotai";
|
||||||
|
import React from "react";
|
||||||
|
|
||||||
|
const useLog = () => {
|
||||||
|
const setLogData = useSetAtom(logAtom);
|
||||||
|
|
||||||
|
const logit = (...args: any) => {
|
||||||
|
log.log(...args);
|
||||||
|
|
||||||
|
const data = [...args].join(" ");
|
||||||
|
setLogData((prevLogData) => [...prevLogData, data]);
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
logit,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export default useLog;
|
Loading…
x
Reference in New Issue
Block a user