Cleanup logrus imports

Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
This commit is contained in:
Maksym Pavlenko
2023-05-05 11:54:14 -07:00
parent 6020903f2c
commit 6f34da5f80
54 changed files with 237 additions and 248 deletions

View File

@@ -23,6 +23,7 @@ import (
"sync"
"github.com/containerd/containerd/cio"
"github.com/containerd/containerd/log"
"github.com/sirupsen/logrus"
"github.com/containerd/containerd/pkg/cri/util"
@@ -109,12 +110,12 @@ func (c *ContainerIO) Pipe() {
wg.Add(1)
go func() {
if _, err := io.Copy(c.stdoutGroup, c.stdout); err != nil {
logrus.WithError(err).Errorf("Failed to pipe stdout of container %q", c.id)
log.L.WithError(err).Errorf("Failed to pipe stdout of container %q", c.id)
}
c.stdout.Close()
c.stdoutGroup.Close()
wg.Done()
logrus.Debugf("Finish piping stdout of container %q", c.id)
log.L.Debugf("Finish piping stdout of container %q", c.id)
}()
}
@@ -122,12 +123,12 @@ func (c *ContainerIO) Pipe() {
wg.Add(1)
go func() {
if _, err := io.Copy(c.stderrGroup, c.stderr); err != nil {
logrus.WithError(err).Errorf("Failed to pipe stderr of container %q", c.id)
log.L.WithError(err).Errorf("Failed to pipe stderr of container %q", c.id)
}
c.stderr.Close()
c.stderrGroup.Close()
wg.Done()
logrus.Debugf("Finish piping stderr of container %q", c.id)
log.L.Debugf("Finish piping stderr of container %q", c.id)
}()
}
}
@@ -150,9 +151,9 @@ func (c *ContainerIO) Attach(opts AttachOptions) {
wg.Add(1)
go func() {
if _, err := io.Copy(c.stdin, stdinStreamRC); err != nil {
logrus.WithError(err).Errorf("Failed to pipe stdin for container attach %q", c.id)
log.L.WithError(err).Errorf("Failed to pipe stdin for container attach %q", c.id)
}
logrus.Infof("Attach stream %q closed", stdinKey)
log.L.Infof("Attach stream %q closed", stdinKey)
if opts.StdinOnce && !opts.Tty {
// Due to kubectl requirements and current docker behavior, when (opts.StdinOnce &&
// opts.Tty) we have to close container stdin and keep stdout and stderr open until

View File

@@ -21,8 +21,7 @@ import (
"sync"
"github.com/containerd/containerd/cio"
"github.com/sirupsen/logrus"
"github.com/containerd/containerd/log"
cioutil "github.com/containerd/containerd/pkg/ioutil"
)
@@ -68,13 +67,13 @@ func (e *ExecIO) Attach(opts AttachOptions) <-chan struct{} {
wg.Add(1)
go func() {
if _, err := io.Copy(e.stdin, stdinStreamRC); err != nil {
logrus.WithError(err).Errorf("Failed to redirect stdin for container exec %q", e.id)
log.L.WithError(err).Errorf("Failed to redirect stdin for container exec %q", e.id)
}
logrus.Infof("Container exec %q stdin closed", e.id)
log.L.Infof("Container exec %q stdin closed", e.id)
if opts.StdinOnce && !opts.Tty {
e.stdin.Close()
if err := opts.CloseStdin(); err != nil {
logrus.WithError(err).Errorf("Failed to close stdin for container exec %q", e.id)
log.L.WithError(err).Errorf("Failed to close stdin for container exec %q", e.id)
}
} else {
if e.stdout != nil {
@@ -90,7 +89,7 @@ func (e *ExecIO) Attach(opts AttachOptions) <-chan struct{} {
attachOutput := func(t StreamType, stream io.WriteCloser, out io.ReadCloser) {
if _, err := io.Copy(stream, out); err != nil {
logrus.WithError(err).Errorf("Failed to pipe %q for container exec %q", t, e.id)
log.L.WithError(err).Errorf("Failed to pipe %q for container exec %q", t, e.id)
}
out.Close()
stream.Close()
@@ -99,7 +98,7 @@ func (e *ExecIO) Attach(opts AttachOptions) <-chan struct{} {
}
e.closer.wg.Done()
wg.Done()
logrus.Debugf("Finish piping %q of container exec %q", t, e.id)
log.L.Debugf("Finish piping %q of container exec %q", t, e.id)
}
if opts.Stdout != nil {