From 87b2259fb5d5358ac38f6f6a6a35d892764c76a3 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Mon, 14 Sep 2020 08:58:07 -0600 Subject: [PATCH] Address feedback from review --- lib/browser/api/web-contents.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/browser/api/web-contents.ts b/lib/browser/api/web-contents.ts index afd255a10c5dd..c9986ea5f96b4 100644 --- a/lib/browser/api/web-contents.ts +++ b/lib/browser/api/web-contents.ts @@ -461,6 +461,11 @@ const addReturnValueToEvent = (event: any) => { }); }; +const loggingEnabled = () => { + return Object.prototype.hasOwnProperty.call(process.env, 'ELECTRON_ENABLE_LOGGING') || + process.argv.some(arg => arg.toLowerCase().startsWith('--enable-logging')); +}; + // Add JavaScript wrappers for WebContents class. WebContents.prototype._init = function () { // The navigation controller. @@ -545,8 +550,8 @@ WebContents.prototype._init = function () { app.emit('renderer-process-crashed', event, this, ...args); // Log out a hint to help users better debug renderer crashes. - if (!process.env.ELECTRON_ENABLE_LOGGING) { - console.info('Renderer process crashed - setting ELECTRON_ENABLE_LOGGING may provide more information.'); + if (loggingEnabled()) { + console.info('Renderer process crashed - see https://www.electronjs.org/docs/tutorial/application-debugging for potential debugging information.'); } });