refactor: use central logger

This commit is contained in:
2024-07-07 23:45:37 +02:00
parent cf8ff410cc
commit ef108d63e1
86 changed files with 903 additions and 889 deletions

View File

@ -8,13 +8,13 @@ import (
"coopcloud.tech/abra/pkg/config"
"coopcloud.tech/abra/pkg/envfile"
"coopcloud.tech/abra/pkg/log"
"coopcloud.tech/abra/pkg/recipe"
recipePkg "coopcloud.tech/abra/pkg/recipe"
"coopcloud.tech/tagcmp"
"github.com/distribution/reference"
"github.com/go-git/go-git/v5"
"github.com/go-git/go-git/v5/plumbing"
"github.com/sirupsen/logrus"
)
var Warn = "warn"
@ -47,10 +47,10 @@ func (l LintRule) Skip(recipe recipe.Recipe) bool {
if l.SkipCondition != nil {
ok, err := l.SkipCondition(recipe)
if err != nil {
logrus.Debugf("%s: skip condition: %s", l.Ref, err)
log.Debugf("%s: skip condition: %s", l.Ref, err)
}
if ok {
logrus.Debugf("skipping %s based on skip condition", l.Ref)
log.Debugf("skipping %s based on skip condition", l.Ref)
return true
}
}
@ -175,7 +175,7 @@ var LintRules = map[string][]LintRule{
// used in code paths such as "app deploy" to avoid nasty surprises but not for
// the typical linting commands, which do handle other levels.
func LintForErrors(recipe recipe.Recipe) error {
logrus.Debugf("linting for critical errors in %s configs", recipe.Name)
log.Debugf("linting for critical errors in %s configs", recipe.Name)
for level := range LintRules {
if level != "error" {
@ -197,7 +197,7 @@ func LintForErrors(recipe recipe.Recipe) error {
}
}
logrus.Debugf("linting successful, %s is well configured", recipe.Name)
log.Debugf("linting successful, %s is well configured", recipe.Name)
return nil
}
@ -343,12 +343,12 @@ func LintImagePresent(recipe recipe.Recipe) (bool, error) {
func LintHasPublishedVersion(recipe recipe.Recipe) (bool, error) {
catl, err := recipePkg.ReadRecipeCatalogue(false)
if err != nil {
logrus.Fatal(err)
log.Fatal(err)
}
versions, err := recipePkg.GetRecipeCatalogueVersions(recipe.Name, catl)
if err != nil {
logrus.Fatal(err)
log.Fatal(err)
}
if len(versions) == 0 {
@ -429,7 +429,7 @@ func LintValidTags(recipe recipe.Recipe) (bool, error) {
iter, err := repo.Tags()
if err != nil {
logrus.Fatalf("unable to list local tags for %s", recipe.Name)
log.Fatalf("unable to list local tags for %s", recipe.Name)
}
if err := iter.ForEach(func(ref *plumbing.Reference) error {