(options: ServerCrashLogOptions)
| 71 | } |
| 72 | |
| 73 | export function buildServerCrashLogEntry(options: ServerCrashLogOptions): string { |
| 74 | const lines = [ |
| 75 | `${(options.timestamp ?? new Date()).toISOString()} [mux server crash] ${options.event}`, |
| 76 | `pid=${options.pid ?? process.pid} cwd=${options.cwd ?? process.cwd()}`, |
| 77 | `argv=${JSON.stringify(redactServerArgvForLogs(options.argv ?? process.argv))}`, |
| 78 | ]; |
| 79 | |
| 80 | if (options.context && Object.keys(options.context).length > 0) { |
| 81 | lines.push(`context=${formatCrashDetail(options.context)}`); |
| 82 | } |
| 83 | |
| 84 | if (options.detail !== undefined) { |
| 85 | lines.push(formatCrashDetail(options.detail)); |
| 86 | } |
| 87 | |
| 88 | return `${lines.join("\n")}\n`; |
| 89 | } |
| 90 | |
| 91 | export function appendServerCrashLogSync(options: ServerCrashLogOptions): string { |
| 92 | let entry: string; |
no test coverage detected