Handle logging.Logger as log, improve docstring, add retry loop