Skip to content

Commit fd7e7d2

Browse files
authored
Merge pull request #73 from Escape-Technologies/fix/verbosity-max
fix: verbosity max
2 parents f6b3e74 + 2e44b10 commit fd7e7d2

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

pkg/cli/cmd/root.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,11 @@ capabilities.
7272
PersistentPreRunE: func(c *cobra.Command, _ []string) error {
7373
version.WarnIfNotLatestVersion(c.Context())
7474

75-
var envVerbosity = env.GetVerbosity()
76-
rootCmdVerbose = rootCmdVerbose + envVerbosity
75+
verbosityFrom := "command line argument"
76+
if envVerbosity := env.GetVerbosity(); envVerbosity > rootCmdVerbose {
77+
rootCmdVerbose = envVerbosity
78+
verbosityFrom = "environment variable ESCAPE_VERBOSITY"
79+
}
7780

7881
if rootCmdVerbose > 0 { //nolint:mnd
7982
log.SetLevel(logrus.InfoLevel)
@@ -87,7 +90,7 @@ capabilities.
8790
if rootCmdVerbose > 3 { //nolint:mnd
8891
escape.Debug = true
8992
}
90-
log.Info("Verbose mode: %d", rootCmdVerbose)
93+
log.Info("Verbose mode: %d from %s", rootCmdVerbose, verbosityFrom)
9194
log.Info("escape-cli version: %s", version.GetVersion().String())
9295
err := out.SetOutput(rootCmdOutputStr)
9396
if err != nil {

0 commit comments

Comments
 (0)