diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-07-10 06:31:49 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-10 06:31:49 -0400 |
commit | bef1f03d3ca8bfd90f4cbb295d99bf97df74a815 (patch) | |
tree | 79d4a907422c070ec0a2db9628eea170bc16dfaa /libpod/logs | |
parent | 24a5eeafc54ef7b1c04bfa8efe78fddd3f7e4014 (diff) | |
parent | 4624142c2db039343efc8c9b8070cf1e0d3a7262 (diff) | |
download | podman-bef1f03d3ca8bfd90f4cbb295d99bf97df74a815.tar.gz podman-bef1f03d3ca8bfd90f4cbb295d99bf97df74a815.tar.bz2 podman-bef1f03d3ca8bfd90f4cbb295d99bf97df74a815.zip |
Merge pull request #10868 from cdoern/untilLog
Implemented Until Query Parameter for Containers/logs
Diffstat (limited to 'libpod/logs')
-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 |