You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 16, 2021. It is now read-only.
I dug in a little more and wanted to share my findings
Controlling Log Level as Best We Can
While not ideal, it appears that you gain some control over the logging level if you toggle the infoEvents map in listener.go. This will work if you vendor libcompose and either want the logging level at info or debug. I don't see a way to interface with this map at run time. Ideally libcompose respects logrus settings and a developer wouldn't need to modify this map. https://github.com/docker/libcompose/blob/master/project/listener.go
Isolating Issue
I wanted to isolate the log level to a single log so I created the linked gist below. Toggling the log-level on this script shows that the log call to logrus.Infof("Recreating %s", s.name) in /libcompose/docker/service/service.go is unable to be suppressed. Reason is still unclear.
Seems it is possible to control the logging level in [email protected]
Example:
originalLevel := log.GetLevel()
log.SetLevel(log.FatalLevel) // TODO: this is a hack to prevent libcompose from printing errors to the console.
err := proj.Parse()
log.SetLevel(originalLevel) // TODO: this is a hack to prevent libcompose from printing errors to the console.
The above code allows libcompose to be used to detect if a file is a docker-compose file or not.
Usually it prints a bunch of errors if the file is not a valid docker-compose file, but with above code it does not.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi, I can't seem to be able to get libcompose to respect my logger settings.
If I do smth like:
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.
The text was updated successfully, but these errors were encountered: