Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd: allow uppercase value of HASURA_PLUGIN_LOG_LEVEL env #130

Merged
merged 1 commit into from
Jul 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions cmd/hasura-ndc-go/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"fmt"
"os"
"strings"
"time"

"github.com/alecthomas/kong"
Expand All @@ -29,7 +30,7 @@ type NewArguments struct {
}

var cli struct {
LogLevel string `help:"Log level." enum:"debug,info,warn,error" env:"HASURA_PLUGIN_LOG_LEVEL" default:"info"`
LogLevel string `help:"Log level." enum:"debug,info,warn,error,DEBUG,INFO,WARN,ERROR" env:"HASURA_PLUGIN_LOG_LEVEL" default:"info"`
New NewArguments `cmd:"" help:"Initialize an NDC connector boilerplate. For example:\n hasura-ndc-go new -n example -m github.com/foo/example"`
Update UpdateArguments `cmd:"" help:"Generate schema and implementation for the connector from functions."`
Generate UpdateArguments `cmd:"" help:"(deprecated) The alias of the 'update' command."`
Expand Down Expand Up @@ -111,7 +112,7 @@ func execUpdate(args *UpdateArguments, start time.Time) {
}

func setupGlobalLogger(level string) {
logLevel, err := zerolog.ParseLevel(level)
logLevel, err := zerolog.ParseLevel(strings.ToLower(level))
if err != nil {
log.Fatal().Err(err).Msgf("failed to parse log level: %s", level)
}
Expand Down