diff options
author | Gireesh Punathil <gpunathi@in.ibm.com> | 2018-09-05 10:06:59 -0400 |
---|---|---|
committer | Gireesh Punathil <gpunathi@in.ibm.com> | 2019-01-18 10:34:04 +0530 |
commit | 4f6797378eb6dd290dd5d8dc6417fea22d42ebad (patch) | |
tree | 88967037a1ba9aec47faea701efecf4f44007587 /src/node_options.cc | |
parent | 01cd21973b26a2cbacbe143c5983cb4adf8e7681 (diff) | |
download | node-new-4f6797378eb6dd290dd5d8dc6417fea22d42ebad.tar.gz |
src: merge into core
Make node-report part of core runtime because:
1. When enabled, node-report significantly helps root cause various
types of problems, including support issues sent to the various repos
of the Node.js organization.
2. The requirement of explicitly adding the dependency to node-report
in user applications often represents a blocker to adoption.
Major deviation from the module version of the node-report is that the
report is generated in JSON format, as opposed to human readable text.
No new functionalities have been added, changes that are required for
melding it as a built-in capability has been affected on the module
version of node-report (https://github.com/nodejs/node-report)
Co-authored-by: Bidisha Pyne <bidipyne@in.ibm.com>
Co-authored-by: Howard Hellyer <hhellyer@uk.ibm.com>
Co-authored-by: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Co-authored-by: Julian Alimin <dmastag@yahoo.com>
Co-authored-by: Lakshmi Swetha Gopireddy <lakshmigopireddy@in.ibm.com>
Co-authored-by: Manusaporn Treerungroj <m.treerungroj@gmail.com>
Co-authored-by: Michael Dawson <michael_dawson@ca.ibm.com>
Co-authored-by: Richard Chamberlain <richard_chamberlain@uk.ibm.com>
Co-authored-by: Richard Lau <riclau@uk.ibm.com>
Co-authored-by: Sam Roberts <vieuxtech@gmail.com>
Co-authored-by: Vipin Menon <vipinmv1@in.ibm.com>
PR-URL: https://github.com/nodejs/node/pull/22712
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <Michael_Dawson@ca.ibm.com>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Diffstat (limited to 'src/node_options.cc')
-rw-r--r-- | src/node_options.cc | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/src/node_options.cc b/src/node_options.cc index 1f8d1db7ec..667d7b6b9d 100644 --- a/src/node_options.cc +++ b/src/node_options.cc @@ -34,6 +34,31 @@ void PerProcessOptions::CheckOptions(std::vector<std::string>* errors) { void PerIsolateOptions::CheckOptions(std::vector<std::string>* errors) { per_env->CheckOptions(errors); +#ifdef NODE_REPORT + if (!report_directory.empty() && !per_env->experimental_report) + errors->push_back("--diagnostic-report-directory option is valid only when " + "--experimental-report is set"); + if (!report_filename.empty() && !per_env->experimental_report) + errors->push_back("--diagnostic-report-filename option is valid only when " + "--experimental-report is set"); + if (!report_signal.empty() && !per_env->experimental_report) + errors->push_back("--diagnostic-report-signal option is valid only when " + "--experimental-report is set"); + if (report_on_fatalerror && !per_env->experimental_report) + errors->push_back( + "--diagnostic-report-on-fatalerror option is valid only when " + "--experimental-report is set"); + if (report_on_signal && !per_env->experimental_report) + errors->push_back("--diagnostic-report-on-signal option is valid only when " + "--experimental-report is set"); + if (report_uncaught_exception && !per_env->experimental_report) + errors->push_back( + "--diagnostic-report-uncaught-exception option is valid only when " + "--experimental-report is set"); + if (report_verbose && !per_env->experimental_report) + errors->push_back("--diagnostic-report-verbose option is valid only when " + "--experimental-report is set"); +#endif // NODE_REPORT } void EnvironmentOptions::CheckOptions(std::vector<std::string>* errors) { @@ -119,6 +144,12 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() { &EnvironmentOptions::experimental_vm_modules, kAllowedInEnvironment); AddOption("--experimental-worker", "", NoOp{}, kAllowedInEnvironment); +#ifdef NODE_REPORT + AddOption("--experimental-report", + "enable report generation", + &EnvironmentOptions::experimental_report, + kAllowedInEnvironment); +#endif // NODE_REPORT AddOption("--expose-internals", "", &EnvironmentOptions::expose_internals); AddOption("--http-parser", "Select which HTTP parser to use; either 'legacy' or 'llhttp' " @@ -248,6 +279,42 @@ PerIsolateOptionsParser::PerIsolateOptionsParser() { AddOption("--perf-prof", "", V8Option{}, kAllowedInEnvironment); AddOption("--stack-trace-limit", "", V8Option{}, kAllowedInEnvironment); +#ifdef NODE_REPORT + AddOption("--diagnostic-report-uncaught-exception", + "generate diagnostic report on uncaught exceptions", + &PerIsolateOptions::report_uncaught_exception, + kAllowedInEnvironment); + AddOption("--diagnostic-report-on-signal", + "generate diagnostic report upon receiving signals", + &PerIsolateOptions::report_on_signal, + kAllowedInEnvironment); + AddOption("--diagnostic-report-on-fatalerror", + "generate diagnostic report on fatal (internal) errors", + &PerIsolateOptions::report_on_fatalerror, + kAllowedInEnvironment); + AddOption("--diagnostic-report-signal", + "causes diagnostic report to be produced on provided signal," + " unsupported in Windows. (default: SIGUSR2)", + &PerIsolateOptions::report_signal, + kAllowedInEnvironment); + Implies("--diagnostic-report-signal", "--diagnostic-report-on-signal"); + AddOption("--diagnostic-report-filename", + "define custom report file name." + " (default: YYYYMMDD.HHMMSS.PID.SEQUENCE#.txt)", + &PerIsolateOptions::report_filename, + kAllowedInEnvironment); + AddOption("--diagnostic-report-directory", + "define custom report pathname." + " (default: current working directory of Node.js process)", + &PerIsolateOptions::report_directory, + kAllowedInEnvironment); + AddOption("--diagnostic-report-verbose", + "verbose option for report generation(true|false)." + " (default: false)", + &PerIsolateOptions::report_verbose, + kAllowedInEnvironment); +#endif // NODE_REPORT + Insert(&EnvironmentOptionsParser::instance, &PerIsolateOptions::get_per_env_options); } |