Per review: use short returns to avoid nesting.
Address more review items

- Each process gets its own log file
- Keep track of bytes written to simplify rotation logic
- Write data chunks directly to buffer
- Rotate logs by time (in addition to size)