refactor: check ELECTRON_ENABLE_LOGGING via native implementation (#25623)

This commit is contained in:
Milan Burda 2020-10-06 02:58:31 +02:00 committed by GitHub
parent fec1c0b68b
commit b33f22601e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 59 additions and 1 deletions

View file

@ -461,8 +461,11 @@ const addReturnValueToEvent = (event: any) => {
});
};
const commandLine = process._linkedBinding('electron_common_command_line');
const environment = process._linkedBinding('electron_common_environment');
const loggingEnabled = () => {
return process.env.ELECTRON_ENABLE_LOGGING || app.commandLine.hasSwitch('enable-logging');
return environment.hasVar('ELECTRON_ENABLE_LOGGING') || commandLine.hasSwitch('enable-logging');
};
// Add JavaScript wrappers for WebContents class.