Single thread for logging. Move test code into helpers.