diff --git a/.gitea/workflows/lint.yaml b/.gitea/workflows/lint.yaml index 55492fc..256b293 100644 --- a/.gitea/workflows/lint.yaml +++ b/.gitea/workflows/lint.yaml @@ -9,7 +9,7 @@ jobs: steps: - uses: actions/setup-go@v4 with: - go-version: "1.21.7" + go-version: "1.21.1" cache: false - name: Check out code diff --git a/cmd/cli/main.go b/cmd/cli/main.go index fd26565..f7759b0 100644 --- a/cmd/cli/main.go +++ b/cmd/cli/main.go @@ -5,6 +5,7 @@ import ( "os" "flag" "log" + "log/slog" _ "fmt" _ "gopkg.in/yaml.v3" "decl/internal/resource" @@ -12,6 +13,14 @@ _ "gopkg.in/yaml.v3" func main() { + var programLevel = new(slog.LevelVar) + logger := slog.New(slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{Level: programLevel})) + slog.SetDefault(logger) + if debugLogging,ok := os.LookupEnv("DECL_DEBUG"); ok && debugLogging != "" { + programLevel.Set(slog.LevelDebug) + } else { + programLevel.Set(slog.LevelError) + } file := flag.String("resource-file", "", "Resource file path") resourceUri := flag.String("import-resource", "", "Add an existing resource")