From c82afa8440fb8ef380d69552644be233a83624f0 Mon Sep 17 00:00:00 2001 From: Xiphe Date: Mon, 14 Sep 2020 17:04:04 +0200 Subject: [PATCH] fix: log messages to file in order to debug production apps --- main/index.ts | 1 + package-lock.json | 5 +++++ package.json | 1 + src/index.ts | 1 + src/shared/log.ts | 2 ++ 5 files changed, 10 insertions(+) create mode 100644 src/shared/log.ts diff --git a/main/index.ts b/main/index.ts index 0d2195e..9036d56 100644 --- a/main/index.ts +++ b/main/index.ts @@ -1 +1,2 @@ +import '../src/shared/log'; export { default } from './main'; diff --git a/package-lock.json b/package-lock.json index eb22956..87e4056 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8841,6 +8841,11 @@ "read-pkg-up": "^7.0.0" } }, + "electron-log": { + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/electron-log/-/electron-log-4.2.4.tgz", + "integrity": "sha512-CXbDU+Iwi+TjKzugKZmTRIORIPe3uQRqgChUl19fkW/reFUn5WP7dt+cNGT3bkLV8xfPilpkPFv33HgtmLLewQ==" + }, "electron-mock-ipc": { "version": "0.3.7", "resolved": "https://registry.npmjs.org/electron-mock-ipc/-/electron-mock-ipc-0.3.7.tgz", diff --git a/package.json b/package.json index 0435d4a..65d2849 100644 --- a/package.json +++ b/package.json @@ -75,6 +75,7 @@ "@types/lodash.isequal": "4.5.5", "classnames": "2.2.6", "date-fns": "2.15.0", + "electron-log": "4.2.4", "electron-settings": "3.2.0", "electron-updater": "4.3.4", "expr-eval": "2.0.2", diff --git a/src/index.ts b/src/index.ts index 8d0fcb2..b951211 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,3 +1,4 @@ +import './shared/log'; import 'focus-visible'; import initTheme from './initTheme'; import { InitRes } from './budget/getInitData'; diff --git a/src/shared/log.ts b/src/shared/log.ts new file mode 100644 index 0000000..0a97c46 --- /dev/null +++ b/src/shared/log.ts @@ -0,0 +1,2 @@ +import { functions } from 'electron-log'; +Object.assign(console, functions);