- Replace open/write/flush/close per log call with persistent file handle - Use threading.Queue + background daemon thread for non-blocking writes - Only flush on exception/critical levels or periodically (every 1s idle) - Queue full protection: drop oldest entry instead of blocking event loop - Eliminates disk I/O blocking on slow storage (NFS/cloud disk) during high traffic
2.0 KiB
2.0 KiB