2024-10-04 11:15:54 +02:00
|
|
|
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";
|
|
|
|
|
2024-10-04 11:15:54 +02:00
|
|
|
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]);
|
|
|
|
};
|
|
|
|
|
2024-10-04 11:15:54 +02:00
|
|
|
return logit;
|
2023-04-30 03:42:27 +02:00
|
|
|
};
|
|
|
|
|
2024-10-04 11:15:54 +02:00
|
|
|
export default useLogger;
|