New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: bring --enable-logging functionality in line with Chromium #25089
Conversation
Adds support for two new environment variables, ELECTRON_LOG_FILE and ELECTRON_LOG_LEVEL. If either of these is used, ELECTRON_ENABLE_LOGGING is implied.
Thanks for adding this, can we also implement kLogFile. It will match the following mapping in the end.
Personally I prefer to use command line flags, so it would help my case :) |
These behave identically to the ELECTRON_LOG_FILE and ELECTRON_LOG_LEVEL env variables
@deepak1556 I added kLogFile support. For command-line verbosity I'd like your feedback on the other change here, a new |
While we're on the subject, do you know if that |
yup it can be removed, we don't define |
The @electron/wg-api approved this at the August 24, 2020 meeting |
Basically the request was to stick closer to upstream's logging beahvior. Headless' code was pretty flexible and also pretty close to what this patch was trying to do, so I've updated this patch to adopt that code wholesale. Changes relative to previous version of this PR: * env vars have been dropped * --logging-enabled now takes an optional arg: filename or 'stderr' * logfiles are saved in the same directory as electron exec * upstream switch --logging-level replaces --log-level Changes relative to headless: * keep support for ELECTRON_ENABLE_LOGGING envvar; it is now equivalent to --logging-enabled=stderr * remove the ifdef-NDEBUG-use-DIR_USER_DATA code because DIR_USER_DATA isn't initialized by the time we reach InitLogging * omit code that uses the kProcessType switch because we don't use it?
@ckerr could you fix this up so we can merge? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Release Notes Persisted
|
I was unable to backport this PR to "14-x-y" cleanly; |
) (#29963) Co-authored-by: Jeremy Rose <jeremya@chromium.org> Co-authored-by: Charles Kerr <charles@charleskerr.com>
…ctron#25089) Co-authored-by: Jeremy Rose <jeremya@chromium.org>
Description of Change
This adds support for several features of Chromium's logging system that were previously not exposed in Electron. In particular:
--log-file=.../path/to/file.log
along with--enable-logging
. Passing--enable-logging=file
without--log-file
will send logs to a default path,electron_debug.log
in the user-data directory.ELECTRON_ENABLE_LOGGING=[1|file]
is equivalent to passing--enable-logging
/--enable-logging=file
ELECTRON_LOG_FILE=.../path/to/file.log
is equivalent to passing--log-file=.../path/to/file.log
--log-level=n
to set the minimum level of log messages printed.app.commandLine.appendSwitch()
will be read immediately after the first run of JS.CC'ing @electron/wg-api
Checklist
npm test
passesRelease Notes
Notes: Added support for directing Chromium logging to a file with
--log-file=.../path/to/file.log
. Also, it's now possible to enable logging from JavaScript by appending command-line switches during the first JS tick.