Skip to content

Commit

Permalink
Use logrus instead of direct output to stderr.
Browse files Browse the repository at this point in the history
Signed-off-by: Felix Fontein <[email protected]>
  • Loading branch information
felixfontein authored and ndeloof committed Sep 11, 2024
1 parent 329ad73 commit 1d608e0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion pkg/compose/build_classic.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ import (
"github.com/docker/docker/pkg/streamformatter"

"github.com/docker/compose/v2/pkg/api"

"github.com/sirupsen/logrus"
)

//nolint:gocyclo
Expand Down Expand Up @@ -180,7 +182,7 @@ func (s *composeService) doBuildClassic(ctx context.Context, project *types.Proj
aux := func(msg jsonmessage.JSONMessage) {
var result dockertypes.BuildResult
if err := json.Unmarshal(*msg.Aux, &result); err != nil {
fmt.Fprintf(s.stderr(), "Failed to parse aux message: %s", err)
logrus.Errorf("Failed to parse aux message: %s", err)
} else {
imageID = result.ID
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/compose/down.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (
imageapi "github.com/docker/docker/api/types/image"
"github.com/docker/docker/api/types/network"
"github.com/docker/docker/errdefs"
"github.com/sirupsen/logrus"
"golang.org/x/sync/errgroup"
)

Expand Down Expand Up @@ -107,7 +108,7 @@ func (s *composeService) down(ctx context.Context, projectName string, options a
}

if !resourceToRemove && len(ops) == 0 {
fmt.Fprintf(s.stderr(), "Warning: No resource found to remove for project %q.\n", projectName)
logrus.Warnf("Warning: No resource found to remove for project %q.", projectName)
}

eg, _ := errgroup.WithContext(ctx)
Expand Down

0 comments on commit 1d608e0

Please sign in to comment.