Skip to content

Use Claude Code with your ChatGPT, Kimi, Cursor or Grok subscription via a local Anthropic-compatible proxy

Rust

log: fix rotation thrashing when rename fails

Raine Virta0e4b66dd4f70
diff --git a/src/log.ts b/src/log.ts
index 8462e1e..10f1d00 100644
--- a/src/log.ts
+++ b/src/log.ts
@@ -47,11 +47,11 @@ async function maybeRotate(): Promise<void> {
const s = await stat(file).catch(() => undefined)
if (!s || s.size < MAX_LOG_BYTES) return
const rotated = join(dir, `proxy.log.${Date.now()}`)
+ await rename(file, rotated)
if (stream) {
stream.end()
stream = undefined
}
- await rename(file, rotated).catch(() => {})
} catch {
// Never propagate rotation errors — logging must never crash the proxy.
} finally {