Add the names flag for pod logs

Fixes containers#13261

Signed-off-by: Xueyuan Chen <X.Chen-47@student.tudelft.nl>
This commit is contained in:
Xueyuan Chen
2022-02-26 23:07:25 +01:00
committed by Xueyuan Chen
parent c39dffe83d
commit 40c6192e9e
4 changed files with 42 additions and 3 deletions

View File

@ -1,5 +1,5 @@
//+build linux
//+build systemd
//go:build linux && systemd
// +build linux,systemd
package libpod
@ -235,6 +235,9 @@ func (c *Container) readFromJournal(ctx context.Context, options *logs.LogOption
logrus.Errorf("Failed parse log line: %v", err)
return
}
if options.UseName {
logLine.CName = c.Name()
}
if doTail {
tailQueue = append(tailQueue, logLine)
continue