process.report.writeReport([filename][, err])
-
filename<string> 写入报告的文件的名称。 这应该是相对路径,如果未指定,它将附加到process.report.directory中指定的目录或 Node.js 进程的当前工作目录。 -
err<Error> 用于报告 JavaScript 堆栈的自定义错误。 -
返回: <string> 返回生成的报告的文件名。
将诊断报告写入文件。
如果未提供 filename,则默认文件名包括日期、时间、PID 和序列号。
报告的 JavaScript 堆栈跟踪取自 err(如果存在)。
import { report } from 'node:process';
report.writeReport();const { report } = require('node: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 inprocess.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.
import { report } from 'node:process';
report.writeReport();const { report } = require('node:process');
report.writeReport();Additional documentation is available in the report documentation.