Skip to content

Commit 6966847

Browse files
committed
Expose timestamps, since args in Container.logs
Behavior is defined as what docker does needed for avoiding duplicate log statements
1 parent 164efd3 commit 6966847

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

repo2docker/docker.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ def __init__(self, container):
1313
def reload(self):
1414
return self._c.reload()
1515

16-
def logs(self, *, stream=False):
17-
return self._c.logs(stream=stream)
16+
def logs(self, *, stream=False, timestamps=False, since=None):
17+
return self._c.logs(stream=stream, timestamps=timestamps, since=since)
1818

1919
def kill(self, *, signal="KILL"):
2020
return self._c.kill(signal=signal)

repo2docker/engine.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,21 @@ def reload(self):
2121
"""
2222

2323
@abstractmethod
24-
def logs(self, *, stream=False):
24+
def logs(self, *, stream=False, timestamps=False, since=None):
2525
"""
2626
Get the container logs.
2727
2828
Parameters
2929
----------
3030
stream : bool
3131
If `True` return an iterator over the log lines, otherwise return all logs
32+
timestamps : bool
33+
If `True` log lines will be prefixed with iso8601 timestamps followed by space
34+
since : int
35+
An integer timestamp.
36+
Can be constructed by parsing timestamps in prefixed lines issued when `timestamps=True`.
37+
If given, start logs from this point,
38+
instead of from container start.
3239
3340
Returns
3441
-------

0 commit comments

Comments
 (0)