fix(logger): batch fix audit-logger, circular meta, and sync callers

- Make logAudit and closeAuditLogger synchronous (were async for no reason)
- Set audit-logger silent:true initially, enable on applyAuditConfig()
- Add try-catch for circular references in consoleFormat meta JSON
- Update all callers to remove unnecessary await/.catch() on sync functions
- Add comment to shared.ts explaining acceptable sync FS usage
- Fix audit-logger test for sync closeAuditLogger

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Misaka
2026-04-03 21:25:06 +08:00
parent a2e3681c8f
commit 6a9d144bbc
10 changed files with 37 additions and 24 deletions

View File

@@ -274,7 +274,7 @@ export class CleanerApplicationService {
? 'failure'
: 'success'
await logAudit('CLEAN', String(currentUser.id), {
logAudit('CLEAN', String(currentUser.id), {
username: currentUser.username,
computerName: (await import('os')).hostname(),
resource: 'MATERIAL_PLAN',
@@ -288,7 +288,7 @@ export class CleanerApplicationService {
materialsSkipped: result.materialsSkipped,
errorCount: result.errors.length
}
}).catch((err) => log.warn('Failed to write audit log', { err }))
})
}
private async generateAndUploadReport(