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

@@ -25,7 +25,7 @@ import (
"github.com/containerd/containerd/cmd/ctr/commands"
"github.com/containerd/containerd/cmd/ctr/commands/tasks"
"github.com/containerd/containerd/errdefs"
"github.com/sirupsen/logrus"
"github.com/containerd/containerd/log"
"github.com/urfave/cli"
)
@@ -124,7 +124,7 @@ var restoreCommand = cli.Command{
}
if err := tasks.HandleConsoleResize(ctx, task, con); err != nil {
logrus.WithError(err).Error("console resize")
log.G(ctx).WithError(err).Error("console resize")
}
status := <-statusC

View File

@@ -30,10 +30,10 @@ import (
"github.com/containerd/containerd/cmd/ctr/commands/tasks"
"github.com/containerd/containerd/containers"
clabels "github.com/containerd/containerd/labels"
"github.com/containerd/containerd/log"
"github.com/containerd/containerd/oci"
gocni "github.com/containerd/go-cni"
specs "github.com/opencontainers/runtime-spec/specs-go"
"github.com/sirupsen/logrus"
"github.com/urfave/cli"
)
@@ -199,7 +199,7 @@ var Command = cli.Command{
defer func() {
if enableCNI {
if err := network.Remove(ctx, commands.FullID(ctx, container), ""); err != nil {
logrus.WithError(err).Error("network review")
log.L.WithError(err).Error("network review")
}
}
task.Delete(ctx)
@@ -232,7 +232,7 @@ var Command = cli.Command{
}
if tty {
if err := tasks.HandleConsoleResize(ctx, task, con); err != nil {
logrus.WithError(err).Error("console resize")
log.L.WithError(err).Error("console resize")
}
} else {
sigc := commands.ForwardAllSignals(ctx, task)
@@ -262,7 +262,7 @@ func buildLabels(cmdLabels, imageLabels map[string]string) map[string]string {
} else {
// In case the image label is invalid, we output a warning and skip adding it to the
// container.
logrus.WithError(err).Warnf("unable to add image label with key %s to the container", k)
log.L.WithError(err).Warnf("unable to add image label with key %s to the container", k)
}
}
// labels from the command line will override image and the initial image config labels

View File

@@ -25,11 +25,11 @@ import (
"github.com/containerd/console"
"github.com/containerd/containerd"
"github.com/containerd/containerd/cmd/ctr/commands"
"github.com/containerd/containerd/log"
"github.com/containerd/containerd/oci"
"github.com/containerd/containerd/pkg/netns"
"github.com/containerd/containerd/snapshots"
specs "github.com/opencontainers/runtime-spec/specs-go"
"github.com/sirupsen/logrus"
"github.com/urfave/cli"
)
@@ -122,7 +122,7 @@ func NewContainer(ctx gocontext.Context, client *containerd.Client, context *cli
con := console.Current()
size, err := con.Size()
if err != nil {
logrus.WithError(err).Error("console size")
log.L.WithError(err).Error("console size")
}
opts = append(opts, oci.WithTTYSize(int(size.Width), int(size.Height)))
}

View File

@@ -30,13 +30,13 @@ import (
"github.com/containerd/console"
"github.com/containerd/containerd/api/runtime/task/v2"
"github.com/containerd/containerd/cmd/ctr/commands"
"github.com/containerd/containerd/log"
"github.com/containerd/containerd/namespaces"
ptypes "github.com/containerd/containerd/protobuf/types"
"github.com/containerd/containerd/runtime/v2/shim"
"github.com/containerd/ttrpc"
"github.com/containerd/typeurl/v2"
"github.com/opencontainers/runtime-spec/specs-go"
"github.com/sirupsen/logrus"
"github.com/urfave/cli"
)
@@ -204,7 +204,7 @@ var execCommand = cli.Command{
}
fmt.Printf("exec running with pid %d\n", r.Pid)
if context.Bool("attach") {
logrus.Info("attaching")
log.L.Info("attaching")
if tty {
current := console.Current()
defer current.Reset()

View File

@@ -24,7 +24,7 @@ import (
"github.com/containerd/containerd"
"github.com/containerd/containerd/errdefs"
"github.com/sirupsen/logrus"
"github.com/containerd/containerd/log"
)
type killer interface {
@@ -38,16 +38,16 @@ func ForwardAllSignals(ctx gocontext.Context, task killer) chan os.Signal {
go func() {
for s := range sigc {
if canIgnoreSignal(s) {
logrus.Debugf("Ignoring signal %s", s)
log.L.Debugf("Ignoring signal %s", s)
continue
}
logrus.Debug("forwarding signal ", s)
log.L.Debug("forwarding signal ", s)
if err := task.Kill(ctx, s.(syscall.Signal)); err != nil {
if errdefs.IsNotFound(err) {
logrus.WithError(err).Debugf("Not forwarding signal %s", s)
log.L.WithError(err).Debugf("Not forwarding signal %s", s)
return
}
logrus.WithError(err).Errorf("forward signal %s", s)
log.L.WithError(err).Errorf("forward signal %s", s)
}
}
}()

View File

@@ -20,7 +20,7 @@ import (
"github.com/containerd/console"
"github.com/containerd/containerd/cio"
"github.com/containerd/containerd/cmd/ctr/commands"
"github.com/sirupsen/logrus"
"github.com/containerd/containerd/log"
"github.com/urfave/cli"
)
@@ -66,7 +66,7 @@ var attachCommand = cli.Command{
if tty {
if err := HandleConsoleResize(ctx, task, con); err != nil {
logrus.WithError(err).Error("console resize")
log.L.WithError(err).Error("console resize")
}
} else {
sigc := commands.ForwardAllSignals(ctx, task)

View File

@@ -26,8 +26,8 @@ import (
"github.com/containerd/containerd"
"github.com/containerd/containerd/cio"
"github.com/containerd/containerd/cmd/ctr/commands"
"github.com/containerd/containerd/log"
"github.com/containerd/containerd/oci"
"github.com/sirupsen/logrus"
"github.com/urfave/cli"
)
@@ -174,7 +174,7 @@ var execCommand = cli.Command{
}
if tty {
if err := HandleConsoleResize(ctx, process, con); err != nil {
logrus.WithError(err).Error("console resize")
log.L.WithError(err).Error("console resize")
}
} else {
sigc := commands.ForwardAllSignals(ctx, process)

View File

@@ -23,10 +23,10 @@ import (
"github.com/containerd/containerd"
"github.com/containerd/containerd/cmd/ctr/commands"
"github.com/containerd/containerd/log"
gocni "github.com/containerd/go-cni"
"github.com/containerd/typeurl/v2"
"github.com/moby/sys/signal"
"github.com/sirupsen/logrus"
"github.com/urfave/cli"
)
@@ -54,7 +54,7 @@ func RemoveCniNetworkIfExist(ctx context.Context, container containerd.Container
return err
}
if err := network.Remove(ctx, commands.FullID(ctx, container), ""); err != nil {
logrus.WithError(err).Error("network remove error")
log.L.WithError(err).Error("network remove error")
return err
}
}

View File

@@ -23,7 +23,7 @@ import (
"github.com/containerd/containerd"
"github.com/containerd/containerd/cio"
"github.com/containerd/containerd/cmd/ctr/commands"
"github.com/sirupsen/logrus"
"github.com/containerd/containerd/log"
"github.com/urfave/cli"
)
@@ -115,7 +115,7 @@ var startCommand = cli.Command{
}
if tty {
if err := HandleConsoleResize(ctx, task, con); err != nil {
logrus.WithError(err).Error("console resize")
log.L.WithError(err).Error("console resize")
}
} else {
sigc := commands.ForwardAllSignals(ctx, task)