From 11750df51015a675c1145982847e08397c7606ea Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Thu, 31 Oct 2019 15:39:06 +0100 Subject: logs: support --tail 0 change the default to -1, so that we can change the semantic of "--tail 0" to not print any existing log line. Closes: https://github.com/containers/libpod/issues/4396 Signed-off-by: Giuseppe Scrivano --- libpod/logs/log.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'libpod/logs') diff --git a/libpod/logs/log.go b/libpod/logs/log.go index 0b1703567..0330df06a 100644 --- a/libpod/logs/log.go +++ b/libpod/logs/log.go @@ -31,7 +31,7 @@ type LogOptions struct { Details bool Follow bool Since time.Time - Tail uint64 + Tail int64 Timestamps bool Multi bool WaitGroup *sync.WaitGroup @@ -54,8 +54,10 @@ func GetLogFile(path string, options *LogOptions) (*tail.Tail, []*LogLine, error logTail []*LogLine ) // whence 0=origin, 2=end - if options.Tail > 0 { + if options.Tail >= 0 { whence = 2 + } + if options.Tail > 0 { logTail, err = getTailLog(path, int(options.Tail)) if err != nil { return nil, nil, err -- cgit v1.2.3-54-g00ecf