To increase parallelism, the logging could be moved to a background thread.
Currently, writing to the debug log is done in-line (synchronous) and unbuffered. See https://github.com/bitcoin/bitcoin/blob/a22b62481aae95747830bd3c0db3227860b12d8e/src/logging.cpp#L56
That means that on slow disks (non-ssd, mostly), calls to LogPrint*() are potentially expensive and blocking further execution of the calling thread (potentially the net processing or validation thread).
Moving logging to a background thread should be fine, except for some edge cases:
- We use
assert_debug_login the functional tests, which assume that a message is written to the debug log synchronous. However, the recently added polling toassert_debug_logshould work around that. - The logging thread should probably be started when logging is started and shut down when the node is shut down. Calls to logging during shutdown should probably be in-line.

