From 200014a42e0df13b66ef795c4fffff245a68ad69 Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Sat, 20 Jul 2024 16:40:52 +0200 Subject: [PATCH] Use logrus instead of direct output to stderr. Signed-off-by: Felix Fontein --- pkg/compose/build_classic.go | 4 +++- pkg/compose/down.go | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/compose/build_classic.go b/pkg/compose/build_classic.go index 9401d812aca..c0942f189fc 100644 --- a/pkg/compose/build_classic.go +++ b/pkg/compose/build_classic.go @@ -44,6 +44,8 @@ import ( "github.com/docker/docker/pkg/streamformatter" "github.com/docker/compose/v2/pkg/api" + + "github.com/sirupsen/logrus" ) //nolint:gocyclo @@ -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 } diff --git a/pkg/compose/down.go b/pkg/compose/down.go index cecb0583a86..2c2e75dc48d 100644 --- a/pkg/compose/down.go +++ b/pkg/compose/down.go @@ -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" ) @@ -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)