Block until all messages being logged have finished processing.
Manually calling
flush is not usually necessary because all log
messages are processed as soon as possible, and
with ensures
that no log message is left unprocessed. However, the actual printing
of log messages happens asynchronously, meaning there might be log
messages still waiting to be processed. A call to
flush will
block until all pending log messages have been processed.
Please see
log to understand how exceptions behave in this
function (hint: they behave unsurprisingly).