Skip to content

Commit

Permalink
Address feedback from review
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytere committed Sep 14, 2020
1 parent 45f8abc commit 87b2259
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/browser/api/web-contents.ts
Expand Up @@ -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.
Expand Down Expand Up @@ -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.');
}
});

Expand Down

0 comments on commit 87b2259

Please sign in to comment.