Skip to main content

rotate_if_oversized

Function rotate_if_oversized 

Source
fn rotate_if_oversized(path: &Path)
Expand description

Size-based rotation: agentmux-launcher.log -> .log.1 -> .log.2 -> .log.3 (oldest dropped), run once per log() call before appending. A metadata() stat per call is cheap relative to the disk write that follows; simplicity here matters more than shaving a syscall. Best-effort like log() itself — any failure (permissions, concurrent access) just leaves the current file growing past the cap rather than losing log data or panicking.