(entry: ErrorLogEntry, options: ErrorLogOptions = {})
| 40 | } |
| 41 | |
| 42 | export function writeErrorLog(entry: ErrorLogEntry, options: ErrorLogOptions = {}): string | null { |
| 43 | try { |
| 44 | const logFile = getErrorLogFilePath(options.dataDir, options.fileName ?? DEFAULT_LOG_FILE); |
| 45 | mkdirSync(path.dirname(logFile), { recursive: true }); |
| 46 | appendFileSync(logFile, `${formatErrorLogEntry(entry, options.now)}\n`, 'utf-8'); |
| 47 | return logFile; |
| 48 | } catch { |
| 49 | return null; |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | export function installProcessErrorLogging(dataDir?: string): void { |
| 54 | if (processHandlersInstalled) return; |
no test coverage detected