From ab6bccade6c5767e9bbbb43aa2a1a1bf5a7fa927 Mon Sep 17 00:00:00 2001 From: Warrick Corfe-Tan Date: Wed, 6 Oct 2021 11:35:57 +1100 Subject: [PATCH] Added additional information to debug logs. --- _locales/en/messages.json | 4 +++- debug_log_preload.js | 4 ++++ js/views/debug_log_view.js | 7 ++++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 8b649412b..148d68311 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -443,5 +443,7 @@ "messageDeletedPlaceholder": "This message has been deleted", "messageDeleted": "Message deleted", "surveyTitle": "Take our Session Survey", - "goToOurSurvey": "Go to our survey" + "goToOurSurvey": "Go to our survey", + "operatingSystem": "Operating System: $operatingSystem$\n", + "commitHash": "Git Commit SHA: $commitHash$\n" } diff --git a/debug_log_preload.js b/debug_log_preload.js index 8121af5d6..dbd23deff 100644 --- a/debug_log_preload.js +++ b/debug_log_preload.js @@ -22,5 +22,9 @@ window.getNodeVersion = () => config.node_version; window.getEnvironment = () => config.environment; require('./js/logging'); +const os = require('os'); + +window.getOSRelease = () => `${os.type()} ${os.release} ${os.platform()}`; +window.getCommitHash = () => config.commitHash; window.closeDebugLog = () => ipcRenderer.send('close-debug-log'); diff --git a/js/views/debug_log_view.js b/js/views/debug_log_view.js index 1ed681538..17bda295a 100644 --- a/js/views/debug_log_view.js +++ b/js/views/debug_log_view.js @@ -26,9 +26,14 @@ this.render(); this.$('textarea').val(i18n('loading')); + const operatingSystemInfo = `${i18n('operatingSystem', window.getOSRelease())}`; + const commitHashInfo = i18n('commitHash', window.getCommitHash()); + // eslint-disable-next-line more/no-then window.log.fetch().then(text => { - this.$('textarea').val(text); + const debugLogWithSystemInfo = operatingSystemInfo + commitHashInfo + text; + + this.$('textarea').val(debugLogWithSystemInfo); }); }, events: {