Expose `timestamps`, `since` args in Container.logs

Behavior is defined as what docker does

needed for avoiding duplicate log statements
pull/1016/head
Min RK 2021-07-07 13:59:43 +02:00
rodzic 164efd31ab
commit 6966847bf9
2 zmienionych plików z 10 dodań i 3 usunięć

Wyświetl plik

@ -13,8 +13,8 @@ class DockerContainer(Container):
def reload(self):
return self._c.reload()
def logs(self, *, stream=False):
return self._c.logs(stream=stream)
def logs(self, *, stream=False, timestamps=False, since=None):
return self._c.logs(stream=stream, timestamps=timestamps, since=since)
def kill(self, *, signal="KILL"):
return self._c.kill(signal=signal)

Wyświetl plik

@ -21,7 +21,7 @@ class Container(ABC):
"""
@abstractmethod
def logs(self, *, stream=False):
def logs(self, *, stream=False, timestamps=False, since=None):
"""
Get the container logs.
@ -29,6 +29,13 @@ class Container(ABC):
----------
stream : bool
If `True` return an iterator over the log lines, otherwise return all logs
timestamps : bool
If `True` log lines will be prefixed with iso8601 timestamps followed by space
since : int
An integer timestamp.
Can be constructed by parsing timestamps in prefixed lines issued when `timestamps=True`.
If given, start logs from this point,
instead of from container start.
Returns
-------