feat: add electron-log package. fix build issue
This commit is contained in:
1 parent
c83bedb395
commit
89f68ce61c
4 files changed
+25
-3
No files matched your search
@@ -1,10 +1,23 @@
|
||||
import { app, WebContents, RenderProcessGoneDetails } from 'electron'
|
||||
import Constants from './utils/Constants'
|
||||
import { createErrorWindow, createMainWindow } from './MainRunner'
|
||||
import log from 'electron-log/main'
|
||||
|
||||
let mainWindow
|
||||
let errorWindow
|
||||
|
||||
const initializeMainLogger = () => {
|
||||
log.initialize({
|
||||
includeFutureSessions: false,
|
||||
preload: true
|
||||
})
|
||||
|
||||
log.transports.file.level = 'silly'
|
||||
log.transports.file.format = '[{y}{m}{d} {h}:{i}:{s}.{ms}|{level}]{text}'
|
||||
log.transports.console.format = '{h}:{i}:{s}.{ms} {text}'
|
||||
log.transports.console.level = 'silly'
|
||||
}
|
||||
|
||||
app.on('ready', async () => {
|
||||
if (Constants.IS_DEV_ENV) {
|
||||
import('./index.dev')
|
||||
@@ -17,6 +30,7 @@ app.on('ready', async () => {
|
||||
systemPreferences.setUserDefault('NSDisabledCharacterPaletteMenuItem', 'boolean', true)
|
||||
}
|
||||
*/
|
||||
initializeMainLogger()
|
||||
|
||||
mainWindow = await createMainWindow()
|
||||
})
|
||||
|
||||
@@ -20,8 +20,6 @@ export default class Constants {
|
||||
* This template includes examples so you can try out several Electron features.
|
||||
* To remove them from your project, you'll need to disable the features below, or find and delete the related code.
|
||||
* ------------------------------------------------------ */
|
||||
static FEAT_APP_LOGGER = true
|
||||
|
||||
// To show devtools at startup. It requires IS_DEV_ENV=true.
|
||||
// Note: For debugging purpose, window won't be closed if click elsewhere, if devtools is open.
|
||||
static FEAT_OPEN_DEV_TOOLS_AT_START = true
|
||||
|
||||
Reference in new issue
Block a user