summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-12-11 10:38:17 -0500
committerGitHub <noreply@github.com>2020-12-11 10:38:17 -0500
commitb0a287ce46ee8326d25efc1e3b9d690eb1e1bbab (patch)
treea08d6774ca2167f8c809c4488483f978a681c843 /libpod
parent99ac30a88287e2c174e69812293f6b130f7a67d5 (diff)
parentba545c49a216d20be83bdfb0357a4d5f0abe6800 (diff)
downloadpodman-b0a287ce46ee8326d25efc1e3b9d690eb1e1bbab.tar.gz
podman-b0a287ce46ee8326d25efc1e3b9d690eb1e1bbab.tar.bz2
podman-b0a287ce46ee8326d25efc1e3b9d690eb1e1bbab.zip
Merge pull request #8686 from Luap99/logs-stderr
podman logs honor stderr correctly
Diffstat (limited to 'libpod')
-rw-r--r--libpod/logs/log.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/libpod/logs/log.go b/libpod/logs/log.go
index a9554088b..d3d83747f 100644
--- a/libpod/logs/log.go
+++ b/libpod/logs/log.go
@@ -210,3 +210,19 @@ func NewLogLine(line string) (*LogLine, error) {
func (l *LogLine) Partial() bool {
return l.ParseLogType == PartialLogType
}
+
+func (l *LogLine) Write(stdout io.Writer, stderr io.Writer, logOpts *LogOptions) {
+ switch l.Device {
+ case "stdout":
+ if stdout != nil {
+ fmt.Fprintln(stdout, l.String(logOpts))
+ }
+ case "stderr":
+ if stderr != nil {
+ fmt.Fprintln(stderr, l.String(logOpts))
+ }
+ default:
+ // Warn the user if the device type does not match. Most likely the file is corrupted.
+ logrus.Warnf("unknown Device type '%s' in log file from Container %s", l.Device, l.CID)
+ }
+}