( needMkdir: boolean, dir: string, path: string, content: string, )
| 269 | // Module-level so .bind captures only its explicit args, not the |
| 270 | // writeFn closure's parent scope (Jarred, #22257). |
| 271 | async function appendAsync( |
| 272 | needMkdir: boolean, |
| 273 | dir: string, |
| 274 | path: string, |
| 275 | content: string, |
| 276 | ): Promise<void> { |
| 277 | if (debugLoggingUnavailable) { |
| 278 | return |
| 279 | } |
| 280 | if (needMkdir) { |
| 281 | try { |
| 282 | await mkdir(dir, { recursive: true }) |
| 283 | } catch (error) { |
| 284 | if (isFsInaccessible(error)) { |
| 285 | markDebugLoggingUnavailable(error) |
| 286 | return |
| 287 | } |
| 288 | } |
| 289 | } |
| 290 | try { |
| 291 | const budgetedContent = await applyDebugLogBudgetAsync(path, content) |
| 292 | if (budgetedContent === null) { |
| 293 | return |
| 294 | } |
| 295 | await appendFile(path, budgetedContent) |
| 296 | void updateLatestDebugLogSymlink() |
| 297 | } catch (error) { |
| 298 | if (isFsInaccessible(error)) { |
| 299 | markDebugLoggingUnavailable(error) |
| 300 | return |
| 301 | } |
| 302 | throw error |
| 303 | } |
| 304 | } |
| 305 | |
| 306 | function noop(): void {} |
| 307 |
nothing calls this directly
no test coverage detected