e3b63c085621405ab211d95df7a80ce9637b5098
Each log_msg opened the file in O_APPEND mode then used writeln!, which issues a separate write() syscall per formatting fragment. O_APPEND only guarantees atomicity per write() call, so concurrent log_msg calls from the app's many threads/tasks could interleave their fragments mid-line. Format the full line (timestamp + msg + newline) into one String, then emit it with a single write_all so each log line lands as one atomic append. No behavior change beyond non-interleaved output. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>