mirror of
https://github.com/zulip/zulip-desktop.git
synced 2025-10-23 03:31:56 +00:00
error-logs: Create a zip file for app logs.
This PR adds the function that when a user clicks of "Show App Logs" from the menu, open the Downloads folder with a zip file containing all the Logs and User Configs. This will help the user to easily share logs with us.
This commit is contained in:
committed by
Akash Nimare
parent
da22f75300
commit
acf7c5a238
@@ -4,6 +4,7 @@ const path = require('path');
|
||||
const { app, shell, BrowserWindow, Menu, dialog } = require('electron');
|
||||
|
||||
const fs = require('fs-extra');
|
||||
const AdmZip = require('adm-zip');
|
||||
const { appUpdater } = require('./autoupdater');
|
||||
|
||||
const ConfigUtil = require(__dirname + '/../renderer/js/utils/config-util.js');
|
||||
@@ -141,13 +142,26 @@ class AppMenu {
|
||||
}, {
|
||||
label: 'Show App Logs',
|
||||
click() {
|
||||
shell.openItem(app.getPath('userData'));
|
||||
const zip = new AdmZip();
|
||||
let date = new Date();
|
||||
date = date.toLocaleDateString().replace(/\//g, '-');
|
||||
|
||||
// Create a zip file of all the logs and config data
|
||||
zip.addLocalFolder(`${app.getPath('appData')}/${appName}/Logs`);
|
||||
zip.addLocalFolder(`${app.getPath('appData')}/${appName}/config`);
|
||||
|
||||
// Put the log file in downloads folder
|
||||
const logFilePath = `${app.getPath('downloads')}/Zulip-logs-${date}.zip`;
|
||||
zip.writeZip(logFilePath);
|
||||
|
||||
// Open and select the log file
|
||||
shell.showItemInFolder(logFilePath);
|
||||
}
|
||||
}, {
|
||||
label: 'Report an Issue...',
|
||||
click() {
|
||||
// the goal is to notify the main.html BrowserWindow
|
||||
// which may not be the focused window.
|
||||
// the goal is to notify the main.html BrowserWindow
|
||||
// which may not be the focused window.
|
||||
BrowserWindow.getAllWindows().forEach(window => {
|
||||
window.webContents.send('open-feedback-modal');
|
||||
});
|
||||
@@ -202,12 +216,12 @@ class AppMenu {
|
||||
AppMenu.sendAction('open-about');
|
||||
}
|
||||
}
|
||||
}, {
|
||||
}, {
|
||||
label: `Check for Update`,
|
||||
click() {
|
||||
AppMenu.checkForUpdate();
|
||||
}
|
||||
}, {
|
||||
}, {
|
||||
type: 'separator'
|
||||
}, {
|
||||
label: 'Desktop App Settings',
|
||||
@@ -314,12 +328,12 @@ class AppMenu {
|
||||
AppMenu.sendAction('open-about');
|
||||
}
|
||||
}
|
||||
}, {
|
||||
}, {
|
||||
label: `Check for Update`,
|
||||
click() {
|
||||
AppMenu.checkForUpdate();
|
||||
}
|
||||
}, {
|
||||
}, {
|
||||
type: 'separator'
|
||||
}, {
|
||||
label: 'Desktop App Settings',
|
||||
|
457
package-lock.json
generated
457
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -181,5 +181,8 @@
|
||||
"browser",
|
||||
"mocha"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"adm-zip": "^0.4.11"
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user