下载目录时如何将 python-swiftclient 的输出保存到文件?

How to save output of python-swiftclient to file when dowloading a directory?

当我使用 python-swiftclient 从云端下载文件时,有时会出现错误,例如:

Error downloading object 'uploads/1/image.png': Object GET failed: https://orbit.brightbox.com/v1/acc-12345/uploads/1/image.png 500 Internal Error b'An error occurred'

要搜索所有错误并重新下载失败的文件,我想将 swift 命令的输出保存到文件中

我尝试了以下方法:

swift-cli -A https://orbit.brightbox.com/v1/acc-12345 \
  -U user -K secret download uploads 2>&1 | tee uploads.log

# and

swift-cli -A https://orbit.brightbox.com/v1/acc-12345 \
  -U user -K secret download uploads > uploads.log

但这没有用。 man swift 描述 -o 选项

For a single object download, you may use the -o [--output] option to redirect the output to a specific file or if "-" then just redirect to stdout or with --no-download actually not to write anything to disk.

但是当我尝试使用 -o 选项下载目录时,如果

失败
-o option only allowed for single file downloads

当我使用 swift CLI 下载目录时,如何将日志保存到文件?

实际上将输出重定向到文件适用于 swift-client:

swift-cli -A https://orbit.brightbox.com/v1/acc-12345 \
  -U user -K secret download uploads > uploads.log

我很困惑,因为在我启动上面的命令后,在另一个终端 window 我做了

tail -f uploads.log

但它没有给我任何输出(就像我在 运行 没有重定向的下载命令时看到的那样)。

似乎 swift-client 批量写入文件,我需要等待大约一分钟,直到 tail -f 将一百行这样的内容转储到控制台中

uploads/documents/1/image.png [auth 0.000s, headers 0.390s, total 14.361s, 0.034 MB/s]