feat: add electron-log package. fix build issue

This commit is contained in:
leejooy96 committed 2025-06-24 09:15:00 +09:00
1 parent c83bedb395
commit 89f68ce61c
4 files changed
+25 -3

No files matched your search

+10
View File
@@ -9,6 +9,7 @@
"version": "1.0.0",
"license": "MIT",
"dependencies": {
"electron-log": "^5.4.1",
"pinia": "^3.0.3",
"qsu": "^1.10.1",
"vue": "^3.5.17",
@@ -5254,6 +5255,15 @@
"rimraf": "^5.0.0"
}
},
"node_modules/electron-log": {
"version": "5.4.1",
"resolved": "https://registry.npmjs.org/electron-log/-/electron-log-5.4.1.tgz",
"integrity": "sha512-QvisA18Z++8E3Th0zmhUelys9dEv7aIeXJlbFw3UrxCc8H9qSRW0j8/ooTef/EtHui8tVmbKSL+EIQzP9GoRLg==",
"license": "MIT",
"engines": {
"node": ">= 14"
}
},
"node_modules/electron-publish": {
"version": "26.0.13",
"resolved": "https://registry.npmjs.org/electron-publish/-/electron-publish-26.0.13.tgz",
+1 -1
View File
@@ -42,6 +42,7 @@
"node": ">=18.0.0"
},
"dependencies": {
"electron-log": "^5.4.1",
"pinia": "^3.0.3",
"qsu": "^1.10.1",
"vue": "^3.5.17",
@@ -60,7 +61,6 @@
"electron": "^36.5.0",
"electron-builder": "^26.0.14",
"electron-extension-installer": "^1.2.0",
"electron-log": "^5.4.1",
"eslint": "^9.29.0",
"eslint-config-prettier": "^10.1.5",
"eslint-plugin-import": "^2.31.0",
+14
View File
@@ -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()
})
-2
View File
@@ -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