process.report.writeReport([filename][, err])


  • filename <string> 写入报告的文件的名称。 这应该是相对路径,如果未指定,它将附加到 process.report.directory 中指定的目录或 Node.js 进程的当前工作目录。

  • err <Error> 用于报告 JavaScript 堆栈的自定义错误。

  • 返回: <string> 返回生成的报告的文件名。

将诊断报告写入文件。 如果未提供 filename,则默认文件名包括日期、时间、PID 和序列号。 报告的 JavaScript 堆栈跟踪取自 err(如果存在)。

process.report.writeReport();

报告文档中提供了额外文档。

  • filename <string> Name of the file where the report is written. This should be a relative path, that will be appended to the directory specified in process.report.directory, or the current working directory of the Node.js process, if unspecified.

  • err <Error> A custom error used for reporting the JavaScript stack.

  • Returns: <string> Returns the filename of the generated report.

Writes a diagnostic report to a file. If filename is not provided, the default filename includes the date, time, PID, and a sequence number. The report's JavaScript stack trace is taken from err, if present.

process.report.writeReport();

Additional documentation is available in the report documentation.