1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-19 13:29:41 +02:00

fix(libstack): redirect the Docker and Compose logging to zerolog BE-11518 (#289)

This commit is contained in:
andres-portainer 2025-01-08 16:26:04 -03:00 committed by GitHub
parent 4010174f66
commit 24fdb1f600
4 changed files with 8 additions and 8 deletions

View file

@ -23,12 +23,18 @@ import (
"github.com/docker/compose/v2/pkg/compose"
"github.com/docker/docker/registry"
"github.com/rs/zerolog/log"
"github.com/sirupsen/logrus"
)
const PortainerEdgeStackLabel = "io.portainer.edge_stack_id"
var mu sync.Mutex
func init() {
// Redirect Compose logging to zerolog
logrus.SetOutput(log.Logger)
}
func withCli(
ctx context.Context,
options libstack.Options,
@ -36,7 +42,7 @@ func withCli(
) error {
ctx = context.Background()
cli, err := command.NewDockerCli()
cli, err := command.NewDockerCli(command.WithCombinedStreams(log.Logger))
if err != nil {
return fmt.Errorf("unable to create a Docker client: %w", err)
}