process.report.getReport([err])
返回正在运行的进程的诊断报告的 JavaScript 对象表示形式。
报告的 JavaScript 堆栈跟踪取自 err
(如果存在)。
const data = process.report.getReport();
console.log(data.header.nodejsVersion);
// 类似于 process.report.writeReport()
const fs = require('fs');
fs.writeFileSync('my-report.log', util.inspect(data), 'utf8');
报告文档中提供了额外文档。
Returns a JavaScript Object representation of a diagnostic report for the
running process. The report's JavaScript stack trace is taken from err
, if
present.
const data = process.report.getReport();
console.log(data.header.nodejsVersion);
// Similar to process.report.writeReport()
const fs = require('fs');
fs.writeFileSync('my-report.log', util.inspect(data), 'utf8');
Additional documentation is available in the report documentation.