This commit is contained in:
Araxeus
2021-04-17 21:17:07 +03:00
parent 3f50ab7cfc
commit 97a9e63231
4 changed files with 38 additions and 31 deletions

15
providers/front-logger.js Normal file
View File

@ -0,0 +1,15 @@
const { ipcRenderer } = require("electron");
function logToString(log) {
let string = (typeof log === "string") ? log : log.toString();
if (!string || string.includes("[object Object]")) {
string = JSON.stringify(log, null, "\t");
}
return string;
}
module.exports = () => {
ipcRenderer.on("log", (event, log) => {
console.log(logToString(log));
});
};