summaryrefslogtreecommitdiffhomepage
path: root/app
diff options
context:
space:
mode:
authorJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2018-07-23 16:30:38 -0300
committerJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2018-07-23 18:12:13 -0300
commitfec437d345134d56a5f614d8dc6cd371400e5deb (patch)
treed7bdf85881fd480af9cf5e55e5aa0a3eb80985e4 /app
parent343787938b22a6aa8b025316ce27a7389a19c0a0 (diff)
downloadmullvadvpn-fec437d345134d56a5f614d8dc6cd371400e5deb.tar.xz
mullvadvpn-fec437d345134d56a5f614d8dc6cd371400e5deb.zip
Rotate UI log file
Diffstat (limited to 'app')
-rw-r--r--app/main.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/app/main.js b/app/main.js
index e52ff07df7..6e1e0bbbbc 100644
--- a/app/main.js
+++ b/app/main.js
@@ -1,4 +1,5 @@
// @flow
+import fs from 'fs';
import path from 'path';
import { execFile } from 'child_process';
import mkdirp from 'mkdirp';
@@ -17,6 +18,7 @@ const ApplicationMain = {
_trayIconController: (null: ?TrayIconController),
_logFilePath: '',
+ _oldLogFilePath: (null: ?string),
_connectionFilePollInterval: (null: ?IntervalID),
run() {
@@ -65,6 +67,14 @@ const ApplicationMain = {
// Disable log file in development
log.transports.file.level = false;
} else {
+ try {
+ fs.accessSync(this._logFilePath);
+ this._oldLogFilePath = path.join(logDirectory, 'frontend.old.log');
+ fs.renameSync(this._logFilePath, this._oldLogFilePath);
+ } catch (error) {
+ // No previous log file exists
+ }
+
log.transports.console.level = 'debug';
log.transports.file.level = 'debug';
log.transports.file.file = this._logFilePath;
@@ -202,6 +212,9 @@ const ApplicationMain = {
args.push('--redact', ...toRedact, '--');
}
args.push(this._logFilePath);
+ if (this._oldLogFilePath) {
+ args.push(this._oldLogFilePath);
+ }
execFile(executable, args, { windowsHide: true }, (error, stdout, stderr) => {
if (error) {