set logging levels
Some checks failed
Declarative Tests / test (push) Waiting to run
Lint / golangci-lint (push) Has been cancelled

This commit is contained in:
Matthew Rich 2024-03-27 14:13:33 -07:00
parent 6e21966737
commit b3a6550ac2
2 changed files with 10 additions and 1 deletions

View File

@ -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

View File

@ -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")