set logging levels
This commit is contained in:
parent
6e21966737
commit
b3a6550ac2
@ -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
|
||||
|
@ -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")
|
||||
|
Loading…
Reference in New Issue
Block a user