A local-first personal finance app
:electron: Making Electron server logs visible in devtools (#3219)
Michael Clark1abca7619d62
diff --git a/packages/desktop-electron/index.ts b/packages/desktop-electron/index.tsindex c7d9df8129..d5767d200f 100644--- a/packages/desktop-electron/index.ts+++ b/packages/desktop-electron/index.ts@@ -60,9 +60,21 @@ function createBackgroundProcess() {serverProcess = utilityProcess.fork(__dirname + '/server.js',['--subprocess', app.getVersion()],- isDev ? { execArgv: ['--inspect'] } : undefined,+ isDev ? { execArgv: ['--inspect'], stdio: 'pipe' } : { stdio: 'pipe' },);+ serverProcess.stdout.on('data', (chunk: Buffer) => {+ // Send the Server console.log messages to the main browser window+ clientWin?.webContents.executeJavaScript(`+ console.info('Server Log:', ${JSON.stringify(chunk.toString('utf8'))})`);+ });++ serverProcess.stderr.on('data', (chunk: Buffer) => {+ // Send the Server console.error messages out to the main browser window+ clientWin?.webContents.executeJavaScript(`+ console.error('Server Log:', ${JSON.stringify(chunk.toString('utf8'))})`);+ });+serverProcess.on('message', msg => {switch (msg.type) {case 'captureEvent':diff --git a/packages/loot-core/src/platform/exceptions/index.electron.ts b/packages/loot-core/src/platform/exceptions/index.electron.tsindex 95adc82959..caeb929172 100644--- a/packages/loot-core/src/platform/exceptions/index.electron.ts+++ b/packages/loot-core/src/platform/exceptions/index.electron.ts@@ -1,7 +1,7 @@import type * as T from '.';export const captureException: T.CaptureException = function (exc) {- console.log('[Exception]', exc);+ console.error('[Exception]', exc);};export const captureBreadcrumb: T.CaptureBreadcrumb = function () {};diff --git a/upcoming-release-notes/3219.md b/upcoming-release-notes/3219.mdnew file mode 100644index 0000000000..4c73e3a5fc--- /dev/null+++ b/upcoming-release-notes/3219.md@@ -0,0 +1,6 @@+---+category: Maintenance+authors: [MikesGlitch]+---++Makinig Server logs visible in devtools on Electron