Previously the logging is a plain write to "stderr" which can block the main Lwt/Uwt thread, blocking the stack.
Instead, log to a Buffer, and drain it in a background Thread. If the buffer is full, drop messages and increment a dropped bytes counter. Always log if we drop messages to help debugging.
Also some minor improvements:
errors that aren't errors
a warning that is actually an error
avoid multi-line records to simplify parsing
improve the log source names (usernet -> slirp / main reflecting the code)
Previously the logging is a plain write to "stderr" which can block the main Lwt/Uwt thread, blocking the stack.
Instead, log to a Buffer, and drain it in a background Thread. If the buffer is full, drop messages and increment a dropped bytes counter. Always log if we drop messages to help debugging.
Also some minor improvements: