diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-12-11 10:38:17 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-11 10:38:17 -0500 |
commit | b0a287ce46ee8326d25efc1e3b9d690eb1e1bbab (patch) | |
tree | a08d6774ca2167f8c809c4488483f978a681c843 /libpod | |
parent | 99ac30a88287e2c174e69812293f6b130f7a67d5 (diff) | |
parent | ba545c49a216d20be83bdfb0357a4d5f0abe6800 (diff) | |
download | podman-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.go | 16 |
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) + } +} |