Add basic threading support to new logging.

This is not yet very smart about how often it starts up the
logging event handler thread, nor does it do anything to
prevent excessive logging from consuming too much memory.

Those issues will be handled in later commits.
Add check for unnecessary work in log macro.
Add log benchmarking.

This adds two small benchmarks.
One for calling LOG() with a simple message.
Another for logging messages actually making it to the log.

This also uses the wait_for_log_thread_completion()
function developed for the latter benchmark to speed
up the unit tests.