Skip to content

Commit e09aac4

Browse files
committed
fix: change default app logging path
1 parent 91be10a commit e09aac4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/main/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { app, WebContents, RenderProcessGoneDetails } from 'electron'
22
import Constants from './utils/Constants'
33
import { createErrorWindow, createMainWindow } from './MainRunner'
44
import log from 'electron-log/main'
5+
import { join } from 'path'
56

67
let mainWindow
78
let errorWindow
@@ -12,12 +13,16 @@ const initializeMainLogger = () => {
1213
preload: true
1314
})
1415

16+
const appLogFilePath = join(app.getPath('userData'), 'logs', 'applog.log')
17+
18+
log.transports.file.resolvePathFn = () =>
19+
join(app.getPath('userData'), 'logs', 'applog.log')
1520
log.transports.file.level = 'silly'
1621
log.transports.file.format = '[{y}{m}{d} {h}:{i}:{s}.{ms}|{level}]{text}'
1722
log.transports.console.format = '{h}:{i}:{s}.{ms} {text}'
1823
log.transports.console.level = 'silly'
1924

20-
log.silly('App is ready')
25+
log.silly(`Start logging... (Path: ${appLogFilePath}) App is ready.`)
2126
}
2227

2328
app.on('ready', async () => {

0 commit comments

Comments
 (0)