⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cli-plugins/manager/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import (
"encoding/json"
"strings"

"github.com/containerd/log"
"github.com/docker/cli/cli-plugins/hooks"
"github.com/docker/cli/cli/config"
"github.com/docker/cli/cli/config/configfile"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
)
Expand Down Expand Up @@ -106,7 +106,7 @@ func invokeAndCollectHooks(ctx context.Context, cfg *configfile.ConfigFile, root
var appended bool
nextSteps, appended = appendNextSteps(nextSteps, processedHook)
if !appended {
logrus.Debugf("Plugin %s responded with an empty hook message %q. Ignoring.", pluginName, string(hookReturn))
log.G(ctx).Debugf("Plugin %s responded with an empty hook message %q. Ignoring.", pluginName, string(hookReturn))
}
}
return nextSteps
Expand Down
6 changes: 3 additions & 3 deletions cli-plugins/socket/socket.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"runtime"
"sync"

"github.com/sirupsen/logrus"
"github.com/containerd/log"
)

// EnvKey represents the well-known environment variable used to pass the
Expand All @@ -32,7 +32,7 @@ func NewPluginServer(h func(net.Conn)) (*PluginServer, error) {
if err != nil {
return nil, err
}
logrus.Trace("Plugin server listening on ", l.Addr())
log.L.Logger.Trace("Plugin server listening on ", l.Addr())

if h == nil {
h = func(net.Conn) {}
Expand Down Expand Up @@ -98,7 +98,7 @@ func (pl *PluginServer) Close() error {
if pl == nil {
return nil
}
logrus.Trace("Closing plugin server")
log.L.Logger.Trace("Closing plugin server")
// Close connections first to ensure the connections get io.EOF instead
// of a connection reset.
pl.closeAllConns()
Expand Down
4 changes: 2 additions & 2 deletions cli/command/container/attach.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import (
"errors"
"io"

"github.com/containerd/log"
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/command/completion"
"github.com/moby/moby/api/types/container"
"github.com/moby/moby/client"
"github.com/moby/sys/signal"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -185,6 +185,6 @@ func resizeTTY(ctx context.Context, dockerCli command.Cli, containerID string) {
// After the above resizing occurs, the call to MonitorTtySize below will handle resetting back
// to the actual size.
if err := MonitorTtySize(ctx, dockerCli, containerID, false); err != nil {
logrus.Debugf("Error monitoring TTY size: %s", err)
log.G(ctx).Debugf("Error monitoring TTY size: %s", err)
}
}
4 changes: 2 additions & 2 deletions cli/command/container/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import (
"fmt"
"io"

"github.com/containerd/log"
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/command/completion"
"github.com/docker/cli/cli/config/configfile"
"github.com/docker/cli/opts"
"github.com/moby/moby/api/types/container"
"github.com/moby/moby/client"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -194,7 +194,7 @@ func interactiveExec(ctx context.Context, dockerCli command.Cli, execOptions *cl
}

if err := <-errCh; err != nil {
logrus.Debugf("Error hijack: %s", err)
log.G(ctx).Debugf("Error hijack: %s", err)
return err
}

Expand Down
12 changes: 6 additions & 6 deletions cli/command/container/hijack.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import (
"runtime"
"sync"

"github.com/containerd/log"
"github.com/docker/cli/cli/command"
"github.com/moby/moby/api/pkg/stdcopy"
"github.com/moby/moby/client"
"github.com/moby/term"
"github.com/sirupsen/logrus"
)

// The default escape key sequence: ctrl-p, ctrl-q
Expand Down Expand Up @@ -152,10 +152,10 @@ func (h *hijackedIOStreamer) beginOutputStream(restoreInput func()) <-chan error
_, err = stdcopy.StdCopy(h.outputStream, h.errorStream, h.resp.Reader)
}

logrus.Debug("[hijack] End of stdout")
log.G(context.TODO()).Debug("[hijack] End of stdout")

if err != nil {
logrus.Debugf("Error receiveStdout: %s", err)
log.G(context.TODO()).Debugf("Error receiveStdout: %s", err)
}

outputDone <- err
Expand All @@ -176,7 +176,7 @@ func (h *hijackedIOStreamer) beginInputStream(restoreInput func()) (doneC <-chan
// messages will be in normal type.
restoreInput()

logrus.Debug("[hijack] End of stdin")
log.G(context.TODO()).Debug("[hijack] End of stdin")

if _, ok := err.(term.EscapeError); ok {
detached <- err
Expand All @@ -187,12 +187,12 @@ func (h *hijackedIOStreamer) beginInputStream(restoreInput func()) (doneC <-chan
// This error will also occur on the receive
// side (from stdout) where it will be
// propagated back to the caller.
logrus.Debugf("Error sendStdin: %s", err)
log.G(context.TODO()).Debugf("Error sendStdin: %s", err)
}
}

if err := h.resp.CloseWrite(); err != nil {
logrus.Debugf("Couldn't send EOF: %s", err)
log.G(context.TODO()).Debugf("Couldn't send EOF: %s", err)
}

close(inputDone)
Expand Down
4 changes: 2 additions & 2 deletions cli/command/container/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"strings"
"syscall"

"github.com/containerd/log"
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/command/completion"
Expand All @@ -17,7 +18,6 @@ import (
"github.com/moby/moby/client"
"github.com/moby/sys/signal"
"github.com/moby/term"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
)
Expand Down Expand Up @@ -240,7 +240,7 @@ func runContainer(ctx context.Context, dockerCli command.Cli, runOpts *runOption
return nil
}

logrus.Debugf("Error hijack: %s", err)
log.G(ctx).Debugf("Error hijack: %s", err)
return err
}
status := <-statusChan
Expand Down
4 changes: 2 additions & 2 deletions cli/command/container/signals.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"os"
gosignal "os/signal"

"github.com/containerd/log"
"github.com/moby/moby/client"
"github.com/moby/sys/signal"
"github.com/sirupsen/logrus"
)

// ForwardAllSignals forwards signals to the container
Expand Down Expand Up @@ -52,7 +52,7 @@ func ForwardAllSignals(ctx context.Context, apiClient client.ContainerAPIClient,
Signal: sig,
})
if err != nil {
logrus.Debugf("Error sending signal: %s", err)
log.G(ctx).Debugf("Error sending signal: %s", err)
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions cli/command/container/tty.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import (
"runtime"
"time"

"github.com/containerd/log"
"github.com/docker/cli/cli/command"
"github.com/moby/moby/client"
"github.com/moby/sys/signal"
"github.com/sirupsen/logrus"
)

// TODO(thaJeztah): split resizeTTYTo
Expand Down Expand Up @@ -40,7 +40,7 @@ func resizeTTYTo(ctx context.Context, apiClient resizeClient, id string, height,
}

if err != nil {
logrus.Debugf("Error resize: %s\r", err)
log.G(ctx).Debugf("Error resize: %s\r", err)
}
return err
}
Expand Down
6 changes: 3 additions & 3 deletions cli/command/container/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"context"
"errors"

"github.com/containerd/log"
"github.com/moby/moby/api/types/container"
"github.com/moby/moby/client"
"github.com/sirupsen/logrus"
)

func waitExitOrRemoved(ctx context.Context, apiClient client.APIClient, containerID string, waitRemove bool) <-chan int {
Expand All @@ -32,7 +32,7 @@ func waitExitOrRemoved(ctx context.Context, apiClient client.APIClient, containe
return
case result := <-waitRes.Result:
if result.Error != nil {
logrus.Errorf("Error waiting for container: %v", result.Error.Message)
log.G(ctx).Errorf("Error waiting for container: %v", result.Error.Message)
statusC <- 125
} else {
statusC <- int(result.StatusCode)
Expand All @@ -41,7 +41,7 @@ func waitExitOrRemoved(ctx context.Context, apiClient client.APIClient, containe
if errors.Is(err, context.Canceled) {
return
}
logrus.Errorf("error waiting for container: %v", err)
log.G(ctx).Errorf("error waiting for container: %v", err)
statusC <- 125
}
}()
Expand Down
5 changes: 3 additions & 2 deletions cli/command/inspect/inspector.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@ package inspect

import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
"io"
"text/template"

"github.com/containerd/log"
"github.com/docker/cli/cli"
"github.com/docker/cli/templates"
"github.com/sirupsen/logrus"
)

// Inspector defines an interface to implement to process elements
Expand Down Expand Up @@ -93,7 +94,7 @@ func Inspect(out io.Writer, references []string, tmplStr string, getRef GetRefFu
}

if err := inspector.Flush(); err != nil {
logrus.Error(err)
log.G(context.TODO()).Error(err)
}

if err := errors.Join(errs...); err != nil {
Expand Down
4 changes: 2 additions & 2 deletions cli/command/plugin/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import (
"os"
"path/filepath"

"github.com/containerd/log"
"github.com/distribution/reference"
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/moby/go-archive"
"github.com/moby/go-archive/compression"
"github.com/moby/moby/api/types/plugin"
"github.com/moby/moby/client"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -103,7 +103,7 @@ func runCreate(ctx context.Context, dockerCli command.Cli, options pluginCreateO

comp := compression.None
if options.compress {
logrus.Debugf("compression enabled")
log.G(ctx).Debugf("compression enabled")
comp = compression.Gzip
}

Expand Down
6 changes: 3 additions & 3 deletions cli/command/system/dial_stdio.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"io"
"os"

"github.com/containerd/log"
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -75,10 +75,10 @@ func runDialStdio(ctx context.Context, dockerCli command.Cli) error {
func copier(to halfWriteCloser, from halfReadCloser, debugDescription string) error {
defer func() {
if err := from.CloseRead(); err != nil {
logrus.Errorf("error while CloseRead (%s): %v", debugDescription, err)
log.G(context.TODO()).Errorf("error while CloseRead (%s): %v", debugDescription, err)
}
if err := to.CloseWrite(); err != nil {
logrus.Errorf("error while CloseWrite (%s): %v", debugDescription, err)
log.G(context.TODO()).Errorf("error while CloseWrite (%s): %v", debugDescription, err)
}
}()
if _, err := io.Copy(to, from); err != nil {
Expand Down
11 changes: 6 additions & 5 deletions cli/compose/loader/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package loader

import (
"context"
"errors"
"fmt"
"path"
Expand All @@ -14,6 +15,7 @@ import (
"strings"
"time"

"github.com/containerd/log"
interp "github.com/docker/cli/cli/compose/interpolation"
"github.com/docker/cli/cli/compose/schema"
"github.com/docker/cli/cli/compose/template"
Expand All @@ -27,7 +29,6 @@ import (
"github.com/google/shlex"
"github.com/moby/moby/api/types/network"
"github.com/moby/moby/client/pkg/versions"
"github.com/sirupsen/logrus"
"go.yaml.in/yaml/v3"
)

Expand Down Expand Up @@ -515,7 +516,7 @@ func expandUser(srcPath string, lookupEnv template.Mapping) string {
if strings.HasPrefix(srcPath, "~") {
home, ok := lookupEnv("HOME")
if !ok {
logrus.Warn("cannot expand '~', because the environment lacks HOME")
log.G(context.TODO()).Warn("cannot expand '~', because the environment lacks HOME")
return srcPath
}
return strings.Replace(srcPath, "~", home, 1)
Expand Down Expand Up @@ -555,7 +556,7 @@ func LoadNetworks(source map[string]any, version string) (map[string]types.Netwo
return nil, fmt.Errorf("network %s: network.external.name and network.name conflict; only use network.name", name)
}
if versions.GreaterThanOrEqualTo(version, "3.5") {
logrus.Warnf("network %s: network.external.name is deprecated in favor of network.name", name)
log.G(context.TODO()).Warnf("network %s: network.external.name is deprecated in favor of network.name", name)
}
nw.Name = nw.External.Name
nw.External.Name = ""
Expand Down Expand Up @@ -596,7 +597,7 @@ func LoadVolumes(source map[string]any, version string) (map[string]types.Volume
return nil, fmt.Errorf("volume %s: volume.external.name and volume.name conflict; only use volume.name", name)
}
if versions.GreaterThanOrEqualTo(version, "3.4") {
logrus.Warnf("volume %s: volume.external.name is deprecated in favor of volume.name", name)
log.G(context.TODO()).Warnf("volume %s: volume.external.name is deprecated in favor of volume.name", name)
}
volume.Name = volume.External.Name
volume.External.Name = ""
Expand Down Expand Up @@ -657,7 +658,7 @@ func loadFileObjectConfig(name string, objType string, obj types.FileObjectConfi
return obj, fmt.Errorf("%[1]s %[2]s: %[1]s.external.name and %[1]s.name conflict; only use %[1]s.name", objType, name)
}
if versions.GreaterThanOrEqualTo(details.Version, "3.5") {
logrus.Warnf("%[1]s %[2]s: %[1]s.external.name is deprecated in favor of %[1]s.name", objType, name)
log.G(context.TODO()).Warnf("%[1]s %[2]s: %[1]s.external.name is deprecated in favor of %[1]s.name", objType, name)
}
obj.Name = obj.External.Name
obj.External.Name = ""
Expand Down
Loading
Loading