Skip to content

Commit

Permalink
尝试修复 #170
Browse files Browse the repository at this point in the history
  • Loading branch information
Mrered authored Dec 2, 2023
1 parent 96cabf4 commit 01e45a5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion electron/utils/log.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
import logger from "electron-log";
import { app } from "electron";
import path from "path";

logger.transports.file.level = "debug";
logger.transports.file.maxSize = 1002430; // 10M
logger.transports.file.format =
"[{y}-{m}-{d} {h}:{i}:{s}.{ms}] [{level}]{scope} {text}";

const date = new Date();
const now_date =
date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate();
const logFolder = app.getPath("userData") + "\\logs\\";

const userDataPath = app.getPath("userData");
const logFolder = path.join(userDataPath, "logs");

logger.transports.file.file = logFolder + now_date + ".log";
logger.transports.console.level = false;

export default {
logger,
logFolder,
Expand Down

0 comments on commit 01e45a5

Please sign in to comment.