Allow unit tests to directly peek at length of LogDeque message queue.
Add feedback and hard threshold to logging.

The feedback prevents runaway logging from overwhelming the logger.
The hard threshold prevents blocking in the logging thread triggering the OOM killer.
Add test for logging after thread shutdown.