riptide
riptide copied to clipboard
Debug logger doesn't play nice with non-blocking stderr
The built-in logger currently does not play nice with standard error. Since we make standard I/O handles non-blocking while the Riptide runtime is in control, the logger will rightfully get an EAGAIN or equivalent error from time to time when trying to write a log and the buffer is full. We should update the logger to either:
- Retry failed calls with some sort of delay. Presumably stderr will become ready shortly when this happens, and a retry might be good enough.
- Make the logger a separate asynchoronous task that uses async I/O to write logs, and have the log macros simply append to that task's current buffer.
The latter seems like the more correct solution, but might be trickier, since loggers are global resources.