Add support for "stream" parameter for container.logs() method
mikhailantoshkin opened this issue · comments
Long story short
Docker-py allows stream
parameter in the container.logs()
method, which returns the generator. In combination with since
and until
parameters this allows to handle huge amounts of logs in an orderly fashion by chunking the generator. It will be very useful if container.logs()
method in aiodocker could support stream
parameter, to return, preferably chunked, generator for container logs
- Expected behaviour:
container.logs()
can return a generator as it does in docker-py - Actual behaviour: there is no way to get a generator except for following the container logs
The library has the required facility already.
Try follow
parameter:
async for chunk in container.logs(follow=True, ...):
print(chunk)
Sorry, when I do
async for chunk in container.logs(follow=True, ...):
print(chunk)
Got:
TypeError: 'async for' requires an object with __aiter__ method, got coroutine
@HanfordWu you can use the log
method (no plural):
async for chunk in container.log(follow=True, ...):
print(chunk)