1
0
mirror of https://github.com/upscayl/upscayl.git synced 2024-12-30 00:03:07 +01:00
upscayl/renderer/components/hooks/use-logger.ts

20 lines
428 B
TypeScript
Raw Normal View History

import { logAtom } from "../../atoms/log-atom";
2023-04-30 03:42:27 +02:00
import log from "electron-log/renderer";
import { useSetAtom } from "jotai";
import React from "react";
const useLogger = () => {
2023-04-30 03:42:27 +02:00
const setLogData = useSetAtom(logAtom);
const logit = (...args: any) => {
log.log(...args);
const data = [...args].join(" ");
setLogData((prevLogData) => [...prevLogData, data]);
};
return logit;
2023-04-30 03:42:27 +02:00
};
export default useLogger;