Skip to content
This repository has been archived by the owner on Jun 16, 2021. It is now read-only.
This repository has been archived by the owner on Jun 16, 2021. It is now read-only.

libcompose library ignoring set log levels #487

Open
@stepanstipl

Description

Hi, I can't seem to be able to get libcompose to respect my logger settings.

If I do smth like:

import (
	"github.com/sirupsen/logrus"
        ...
)

func main() {
	logger := logrus.New()
	logger.Formatter = &logrus.JSONFormatter{}
	logger.SetLevel(logrus.ErrorLevel)
	// use logrus for standard log output:
	log.SetOutput(logger.Writer())

	cd, err := data.Asset("docker-compose.yaml")
	if err != nil {
		log.Fatal(err)
	}

	dctx := &ctx.Context{
		Context: project.Context{
			ComposeBytes: [][]byte{cd},
			ProjectName:  "test",
		},
	}

	prj, err := docker.NewProject(dctx, nil)
	if err != nil {log.Fatal(err)
	}

	err = prj.Up(context.Background(), options.Up{})
	if err != nil {
		log.Fatal(err)
	}
}

typically libraries using logrus would respect my logger settings (level & format).

I can't get it working with libcompose, for some reason I'll still see all the logs from info level above with default formatting.

Any idea why is this not working/how I can suppress logs from libcompose? Any help appreciated, cheers.

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions