diff options
author | cdoern <cdoern@redhat.com> | 2021-07-06 14:53:56 -0400 |
---|---|---|
committer | cdoern <cdoern@redhat.com> | 2021-07-09 12:21:46 -0400 |
commit | 4624142c2db039343efc8c9b8070cf1e0d3a7262 (patch) | |
tree | ca5af233eb2ed67036eeffa05f939743196fac38 /libpod/logs/log.go | |
parent | 1a9cb93f16cf19e14581319e2fd1b60e791f74dd (diff) | |
download | podman-4624142c2db039343efc8c9b8070cf1e0d3a7262.tar.gz podman-4624142c2db039343efc8c9b8070cf1e0d3a7262.tar.bz2 podman-4624142c2db039343efc8c9b8070cf1e0d3a7262.zip |
Implemented Until Query Parameter for Containers/logs
compat containers/logs was missing actual usage of until query param.
fixes #10859
Signed-off-by: cdoern <cdoern@redhat.com>
Diffstat (limited to 'libpod/logs/log.go')
-rw-r--r-- | libpod/logs/log.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libpod/logs/log.go b/libpod/logs/log.go index 308053b47..1a0223edc 100644 --- a/libpod/logs/log.go +++ b/libpod/logs/log.go @@ -34,6 +34,7 @@ type LogOptions struct { Details bool Follow bool Since time.Time + Until time.Time Tail int64 Timestamps bool Multi bool @@ -184,7 +185,12 @@ func (l *LogLine) String(options *LogOptions) string { // Since returns a bool as to whether a log line occurred after a given time func (l *LogLine) Since(since time.Time) bool { - return l.Time.After(since) + return l.Time.After(since) || since.IsZero() +} + +// Until returns a bool as to whether a log line occurred before a given time +func (l *LogLine) Until(until time.Time) bool { + return l.Time.Before(until) || until.IsZero() } // NewLogLine creates a logLine struct from a container log string |