feat: add setting custom log level
Some checks failed
CI / build (push) Failing after 3m53s
CI / lint (push) Failing after 3m33s
CI / pkl-validate (push) Successful in 13s
CI / integration-tests (push) Has been skipped
CI / conformance-tests (latest) (push) Has been skipped

This commit is contained in:
2026-02-12 22:51:49 +01:00
parent 6fd95c24fb
commit 476906fe97
2 changed files with 15 additions and 0 deletions

View File

@@ -37,6 +37,15 @@ func getCredentials() (username, token string, err error) {
return username, token, nil
}
func setupLogging() {
programLevel := new(slog.LevelVar)
env := os.Getenv("PROXMOX_LOG_LEVEL")
programLevel.UnmarshalText([]byte(env))
logger := slog.New(slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{Level: programLevel}))
slog.Info("Set log level", "level", programLevel)
slog.SetDefault(logger)
}
func createAuthorizationString(username, token string) string {
return "PVEAPIToken=" + username + "=" + token
}