diff --git a/CHANGELOG.md b/CHANGELOG.md index 221d84701..338f7df9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,8 @@ - Fixes an occasional issue that could cause the people sidebar to become blank if the user's LinkedIn handle was malformed. #1909 +- A new button in Preferences > Accounts allows you to quickly retrieve + copy the last ~50 lines of your sync logs, making it much easier to collect information we need for debugging. + ### 1.7.5 (4/16/2020) **Features:** diff --git a/app/src/flux/mailsync-bridge.ts b/app/src/flux/mailsync-bridge.ts index 16dfe7b11..5bc280d8a 100644 --- a/app/src/flux/mailsync-bridge.ts +++ b/app/src/flux/mailsync-bridge.ts @@ -43,24 +43,6 @@ class CrashTracker { delete this._tooManyFailures[key]; } - tailClientLog(accountId) { - let log = ''; - const logfile = `mailsync-${accountId}.log`; - try { - const logpath = path.join(AppEnv.getConfigDirPath(), logfile); - const { size } = fs.statSync(logpath); - const tailSize = Math.min(1200, size); - const buffer = Buffer.alloc(tailSize); - const fd = fs.openSync(logpath, 'r'); - fs.readSync(fd, buffer, 0, tailSize, size - tailSize); - log = buffer.toString('UTF8'); - log = log.substr(log.indexOf('\n') + 1); - } catch (logErr) { - console.warn(`Could not append ${logfile} to mailsync exception report: ${logErr}`); - } - return log; - } - recordClientCrash(fullAccountJSON, { code, error, signal }) { this._appendCrashToHistory(fullAccountJSON); @@ -190,6 +172,24 @@ export default class MailsyncBridge { this._launchClient(account, keys, { force: true }); } + async tailClientLog(accountId: string) { + let log = ''; + const logfile = `mailsync-${accountId}.log`; + try { + const logpath = path.join(AppEnv.getConfigDirPath(), logfile); + const { size } = fs.statSync(logpath); + const tailSize = Math.min(3000, size); + const buffer = Buffer.alloc(tailSize); + const fd = fs.openSync(logpath, 'r'); + fs.readSync(fd, buffer, 0, tailSize, size - tailSize); + log = buffer.toString('UTF8'); + log = log.substr(log.indexOf('\n') + 1); + } catch (logErr) { + console.warn(`Could not append ${logfile} to mailsync exception report: ${logErr}`); + } + return log; + } + sendSyncMailNow() { console.warn('Sending `wake` to all mailsync workers...'); for (const client of Object.values(this._clients)) { diff --git a/mailsync b/mailsync index e4a0d60d4..bb9599442 160000 --- a/mailsync +++ b/mailsync @@ -1 +1 @@ -Subproject commit e4a0d60d493603ec604a4c702f60e473adbb3335 +Subproject commit bb95994427252dff34b4429d4a6872711113a8f0