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

@ -7,8 +7,8 @@ import (
"coopcloud.tech/abra/pkg/autocomplete"
"coopcloud.tech/abra/pkg/formatter"
"coopcloud.tech/abra/pkg/lint"
"coopcloud.tech/abra/pkg/log"
recipePkg "coopcloud.tech/abra/pkg/recipe"
"github.com/sirupsen/logrus"
"github.com/urfave/cli"
)
@ -30,22 +30,22 @@ var recipeLintCommand = cli.Command{
recipe := internal.ValidateRecipe(c)
if err := recipePkg.EnsureExists(recipe.Name); err != nil {
logrus.Fatal(err)
log.Fatal(err)
}
if !internal.Chaos {
if err := recipePkg.EnsureIsClean(recipe.Name); err != nil {
logrus.Fatal(err)
log.Fatal(err)
}
if !internal.Offline {
if err := recipePkg.EnsureUpToDate(recipe.Name); err != nil {
logrus.Fatal(err)
log.Fatal(err)
}
}
if err := recipePkg.EnsureLatest(recipe.Name); err != nil {
logrus.Fatal(err)
log.Fatal(err)
}
}
@ -57,7 +57,7 @@ var recipeLintCommand = cli.Command{
for level := range lint.LintRules {
for _, rule := range lint.LintRules[level] {
if internal.OnlyErrors && rule.Level != "error" {
logrus.Debugf("skipping %s, does not have level \"error\"", rule.Ref)
log.Debugf("skipping %s, does not have level \"error\"", rule.Ref)
continue
}
@ -75,7 +75,7 @@ var recipeLintCommand = cli.Command{
if !skipped {
ok, err := rule.Function(recipe)
if err != nil {
logrus.Warn(err)
log.Warn(err)
}
if !ok && rule.Level == "error" {
@ -114,7 +114,7 @@ var recipeLintCommand = cli.Command{
}
if hasError {
logrus.Warn("watch out, some critical errors are present in your recipe config")
log.Warn("watch out, some critical errors are present in your recipe config")
}
return nil