Uses own thread to actually write to logs, so the main thread can't be
blocked by a slow logfile. Log entries are buffered in two ringbuffers,
one for the main thread and one for all other threads. The main thread
will copy the second buffer to the main buffer periodically. The main
thread buffer is read from the log worker thread.
Since two buffers are kept, there are now several functions to add a log
entry:
mlog()
for main thread functions only: will never block
tlog()
other threads only: may block, until main thread copied some entries
xlog()
automatically determines, which thread it's been called from and
then writes to the proper buffer (will block accordingly)
To avoid improper usage, mlog and tlog verify, if they are used correctly.
(Only for debug builds. An assert triggers, if necessary.)