mirror of
https://github.com/ershisan99/md-preview-desktop.git
synced 2025-12-16 12:33:38 +00:00
feat: add logging
This commit is contained in:
2314
package-lock.json
generated
2314
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -25,9 +25,10 @@
|
||||
"@fontsource/roboto": "^5.0.8",
|
||||
"@it-incubator/md-bundler": "0.0.10",
|
||||
"@it-incubator/mdx-components": "0.0.11",
|
||||
"@it-incubator/ui-kit": "0.2.20",
|
||||
"@it-incubator/ui-kit": "0.2.24",
|
||||
"builtin-modules": "^3.3.0",
|
||||
"chokidar": "^3.5.3",
|
||||
"electron-log": "^5.0.3",
|
||||
"electron-store": "^8.1.0",
|
||||
"electron-updater": "^6.1.4",
|
||||
"esbuild": "^0.19.5",
|
||||
|
||||
@@ -2,6 +2,7 @@ import fs from 'fs'
|
||||
|
||||
import { is } from '@electron-toolkit/utils'
|
||||
import { BrowserWindow, app, ipcMain } from 'electron'
|
||||
import log from 'electron-log/main'
|
||||
|
||||
import { bundleMdxAndSend } from './bundle-mdx-and-send'
|
||||
import { handleAppReady } from './handlers/handle-app-ready'
|
||||
@@ -10,6 +11,11 @@ import { prepareAndSendDir } from './prepare-and-send-dir'
|
||||
import { setupWatcher } from './setup-watcher'
|
||||
import { store } from './store'
|
||||
|
||||
// Optional, initialize the logger for any renderer process
|
||||
log.initialize()
|
||||
|
||||
log.info('Log from the main process')
|
||||
|
||||
let mainWindow: BrowserWindow | null = null
|
||||
|
||||
function setMainWindow(win: BrowserWindow) {
|
||||
@@ -89,9 +95,12 @@ ipcMain.on('open-file', (_event, filePath) => {
|
||||
|
||||
process
|
||||
.on('unhandledRejection', (reason, p) => {
|
||||
console.error(reason, 'Unhandled Rejection at Promise', p)
|
||||
log.error('Unhandled Rejection at Promise', reason, p)
|
||||
console.error('Unhandled Rejection at Promise', reason, p)
|
||||
})
|
||||
.on('uncaughtException', err => {
|
||||
log.error('Uncaught Exception', err)
|
||||
|
||||
// https://github.com/paulmillr/chokidar/issues/566
|
||||
// this has been open for over 7 years, still hasn't been fixed.
|
||||
// for some reason it doesn't even go into the chokidar error handler, so had to do it here
|
||||
@@ -107,3 +116,5 @@ process
|
||||
process.exit(1)
|
||||
}
|
||||
})
|
||||
|
||||
log.errorHandler.startCatching()
|
||||
|
||||
Reference in New Issue
Block a user