diff options
author | Paul Holzinger <paul.holzinger@web.de> | 2020-12-10 17:39:57 +0100 |
---|---|---|
committer | Paul Holzinger <paul.holzinger@web.de> | 2020-12-10 22:24:43 +0100 |
commit | ba545c49a216d20be83bdfb0357a4d5f0abe6800 (patch) | |
tree | 8b00fa4a88408ed594f2b5e04116b7bcdd933b67 /pkg/domain/infra/abi/containers.go | |
parent | 2bb149034bd67dd4027768863fed2fce853833ae (diff) | |
download | podman-ba545c49a216d20be83bdfb0357a4d5f0abe6800.tar.gz podman-ba545c49a216d20be83bdfb0357a4d5f0abe6800.tar.bz2 podman-ba545c49a216d20be83bdfb0357a4d5f0abe6800.zip |
podman logs honor stderr correctly
Make the ContainerLogsOptions support two io.Writers,
one for stdout and the other for stderr. The logline already
includes the information to which Writer it has to be written.
Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
Diffstat (limited to 'pkg/domain/infra/abi/containers.go')
-rw-r--r-- | pkg/domain/infra/abi/containers.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/pkg/domain/infra/abi/containers.go b/pkg/domain/infra/abi/containers.go index ff4277a2e..ec65dbe44 100644 --- a/pkg/domain/infra/abi/containers.go +++ b/pkg/domain/infra/abi/containers.go @@ -925,7 +925,7 @@ func (ic *ContainerEngine) ContainerRun(ctx context.Context, opts entities.Conta } func (ic *ContainerEngine) ContainerLogs(ctx context.Context, containers []string, options entities.ContainerLogsOptions) error { - if options.Writer == nil { + if options.StdoutWriter == nil && options.StderrWriter == nil { return errors.New("no io.Writer set for container logs") } @@ -963,7 +963,7 @@ func (ic *ContainerEngine) ContainerLogs(ctx context.Context, containers []strin }() for line := range logChannel { - fmt.Fprintln(options.Writer, line.String(logOpts)) + line.Write(options.StdoutWriter, options.StderrWriter, logOpts) } return nil |