Skip to content

Commit

Permalink
reporegistry: move to logrus instead of log.Printf()
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mvo5 committed Oct 30, 2024
1 parent bdc96bd commit 8ee8ef4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/reporegistry/repository.go
Original file line number Diff line number Diff line change
@@ -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"
)
Expand Down Expand Up @@ -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.
Expand All @@ -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)

Check failure on line 62 in pkg/reporegistry/repository.go

View workflow job for this annotation

GitHub Actions / ⌨ Lint

printf: github.com/sirupsen/logrus.Info call has possible Printf formatting directive %s (govet)

distrosRepoConfigs[distro] = distroRepos
}
Expand Down

0 comments on commit 8ee8ef4

Please sign in to comment.