set logging levels
This commit is contained in:
parent
6e21966737
commit
b3a6550ac2
@ -9,7 +9,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/setup-go@v4
|
- uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: "1.21.7"
|
go-version: "1.21.1"
|
||||||
cache: false
|
cache: false
|
||||||
|
|
||||||
- name: Check out code
|
- name: Check out code
|
||||||
|
@ -5,6 +5,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"flag"
|
"flag"
|
||||||
"log"
|
"log"
|
||||||
|
"log/slog"
|
||||||
_ "fmt"
|
_ "fmt"
|
||||||
_ "gopkg.in/yaml.v3"
|
_ "gopkg.in/yaml.v3"
|
||||||
"decl/internal/resource"
|
"decl/internal/resource"
|
||||||
@ -12,6 +13,14 @@ _ "gopkg.in/yaml.v3"
|
|||||||
|
|
||||||
|
|
||||||
func main() {
|
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")
|
file := flag.String("resource-file", "", "Resource file path")
|
||||||
resourceUri := flag.String("import-resource", "", "Add an existing resource")
|
resourceUri := flag.String("import-resource", "", "Add an existing resource")
|
||||||
|
Loading…
Reference in New Issue
Block a user