From 8ee8ef40d52b59a874eeafde5abcaaa06361f2ab Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 29 Oct 2024 13:21:04 +0100 Subject: [PATCH] reporegistry: move to logrus instead of log.Printf() This commit removes the direct log.Printf() from the repo loading. With the coming daemonless CLI frontend to image building these prints are distracting for our users. Instead logrus (which is already used in the images library) is used with the appropriate "Infof()" and "Warnf()" methods. --- pkg/reporegistry/repository.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/reporegistry/repository.go b/pkg/reporegistry/repository.go index 8b9b7ab87a..50d65788a3 100644 --- a/pkg/reporegistry/repository.go +++ b/pkg/reporegistry/repository.go @@ -1,11 +1,12 @@ package reporegistry import ( - "log" "os" "path/filepath" "strings" + "github.com/sirupsen/logrus" + "github.com/osbuild/images/pkg/distroidparser" "github.com/osbuild/images/pkg/rpmmd" ) @@ -39,7 +40,7 @@ func LoadAllRepositories(confPaths []string) (rpmmd.DistrosRepoConfigs, error) { // without a dot to separate major and minor release versions distro, err := distroidparser.DefaultParser.Standardize(distroIDStr) if err != nil { - log.Printf("failed to parse distro ID string, using it as is: %v", err) + logrus.Warnf("failed to parse distro ID string, using it as is: %v", err) // NB: Before the introduction of distro ID standardization, the filename // was used as the distro ID. This is kept for backward compatibility // if the filename can't be parsed. @@ -58,7 +59,7 @@ func LoadAllRepositories(confPaths []string) (rpmmd.DistrosRepoConfigs, error) { return nil, err } - log.Println("Loaded repository configuration file:", configFile) + logrus.Info("Loaded repository configuration file: %s", configFile) distrosRepoConfigs[distro] = distroRepos }