Optimised wait_for_logging() some more.