Skip to content

Commit

Permalink
Remove --loglevel CLI flag (#1470)
Browse files Browse the repository at this point in the history
  • Loading branch information
wata727 authored Sep 7, 2022
1 parent 3e1d0a5 commit cc413d0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ Application Options:
--force Return zero exit status even if issues found
--color Enable colorized output
--no-color Disable colorized output
--loglevel=[trace|debug|info|warn|error] Change the loglevel
Help Options:
-h, --help Show this help message
Expand Down
8 changes: 3 additions & 5 deletions cmd/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,6 @@ func (cli *CLI) Run(args []string) int {
cli.formatter.NoColor = true
}
level := os.Getenv("TFLINT_LOG")
if opts.LogLevel != "" {
level = opts.LogLevel
// Pass log level to plugin processes
os.Setenv("TFLINT_LOG", level)
}
log.SetOutput(&logutils.LevelFilter{
Levels: []logutils.LogLevel{"TRACE", "DEBUG", "INFO", "WARN", "ERROR"},
MinLevel: logutils.LogLevel(strings.ToUpper(level)),
Expand Down Expand Up @@ -169,5 +164,8 @@ func unknownOptionHandler(option string, arg flags.SplitArgument, args []string)
if option == "aws-access-key" || option == "aws-secret-key" || option == "aws-profile" || option == "aws-creds-file" || option == "aws-region" {
return []string{}, fmt.Errorf("`%s` option was removed in v0.23.0. AWS rules are provided by the AWS plugin, so please configure the plugin instead", option)
}
if option == "loglevel" {
return []string{}, errors.New("`loglevel` option was removed in v0.40.0. Please set `TFLINT_LOG` environment variables instead")
}
return []string{}, fmt.Errorf("`%s` is unknown option. Please run `tflint --help`", option)
}
1 change: 0 additions & 1 deletion cmd/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ type Options struct {
Force bool `long:"force" description:"Return zero exit status even if issues found"`
Color bool `long:"color" description:"Enable colorized output"`
NoColor bool `long:"no-color" description:"Disable colorized output"`
LogLevel string `long:"loglevel" description:"Change the loglevel" choice:"trace" choice:"debug" choice:"info" choice:"warn" choice:"error"`
ActAsBundledPlugin bool `long:"act-as-bundled-plugin" hidden:"true"`
}

Expand Down
7 changes: 7 additions & 0 deletions integrationtest/cli/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,13 @@ func TestIntegration(t *testing.T) {
status: cmd.ExitCodeError,
stderr: "`aws-region` option was removed in v0.23.0. AWS rules are provided by the AWS plugin, so please configure the plugin instead",
},
{
name: "removed `--loglevel` option",
command: "./tflint --loglevel debug",
dir: "no_issues",
status: cmd.ExitCodeError,
stderr: "`loglevel` option was removed in v0.40.0. Please set `TFLINT_LOG` environment variables instead",
},
{
name: "invalid options",
command: "./tflint --unknown",
Expand Down

0 comments on commit cc413d0

Please sign in to comment.