()
| 13 | } |
| 14 | |
| 15 | function resolveWritableLogDir(): ResolvedLogDir { |
| 16 | const logDir = |
| 17 | logDirOverrideForTests ?? getWorkspaceFilesystemLayout(getRuntimeInstance().workspaceKey).logs; |
| 18 | |
| 19 | try { |
| 20 | fs.mkdirSync(logDir, { recursive: true }); |
| 21 | fs.accessSync(logDir, fs.constants.W_OK); |
| 22 | } catch (error) { |
| 23 | const message = error instanceof Error ? error.message : String(error); |
| 24 | throw new Error(`Unable to create writable log directory at ${logDir}: ${message}`); |
| 25 | } |
| 26 | |
| 27 | return { |
| 28 | path: logDir, |
| 29 | isOverride: logDirOverrideForTests !== null, |
| 30 | }; |
| 31 | } |
| 32 | |
| 33 | function generateLogFileName(toolName: string): string { |
| 34 | return `${toolName}_${formatLogTimestamp()}_pid${process.pid}_${shortRandomSuffix()}.log`; |
no test coverage detected