feat: 保存 renderer 日志到文件

This commit is contained in:
qier222 2022-04-16 13:30:25 +08:00
parent d3089b8940
commit 4c625b172c
No known key found for this signature in database
GPG key ID: 9C85007ED905F14D
12 changed files with 61 additions and 31 deletions

View file

@ -10,7 +10,7 @@ import {
import Store from 'electron-store'
import { release } from 'os'
import path, { join } from 'path'
import logger from './logger'
import log from './log'
import { initIpcMain } from './ipcMain'
const isWindows = process.platform === 'win32'
@ -18,7 +18,7 @@ const isMac = process.platform === 'darwin'
const isLinux = process.platform === 'linux'
const isDev = process.env.NODE_ENV === 'development'
logger.info('[index] Main process start')
log.info('[index] Main process start')
// Disable GPU Acceleration for Windows 7
if (release().startsWith('6.1')) app.disableHardwareAcceleration()
@ -99,7 +99,7 @@ async function createWindow() {
}
app.whenReady().then(async () => {
logger.info('[index] App ready')
log.info('[index] App ready')
createWindow()
handleWindowEvents()
initIpcMain(win)
@ -113,10 +113,10 @@ app.whenReady().then(async () => {
// eslint-disable-next-line @typescript-eslint/no-var-requires
} = require('electron-devtools-installer')
installExtension(REACT_DEVELOPER_TOOLS.id).catch(err =>
logger.info('An error occurred: ', err)
log.info('An error occurred: ', err)
)
installExtension(REDUX_DEVTOOLS.id).catch(err =>
logger.info('An error occurred: ', err)
log.info('An error occurred: ', err)
)
}
})