conan-io / conan

Conan - The open-source C and C++ package manager
https://conan.io
MIT License
8.3k stars 985 forks source link

[feature] Better handling of invalid CONAN_LOG_LEVEL values #17279

Closed SoShiny closed 2 weeks ago

SoShiny commented 2 weeks ago

What is your suggestion?

Used version 2.9.1.

Observation

CONAN_LOG_LEVEL=verbose conan config home

Works for CONAN_LOG_LEVEL values of quiet, error, warning, notice, status, verbose, v, debug, vv, and trace. This is in line with the -v options of conan config.

However, "unsetting" the CONAN_LOG_LEVEL variable by export CONAN_LOG_LEVEL= or running

CONAN_LOG_LEVEL= conan config home

result in the error message

ERROR: Invalid argument '-v'

Similarly, specifying some random value for CONAN_LOG_LEVEL will still refer to the invalid argument -v<randomvalue>.

This is confusing behavior, since we don't explicitly specify -v on the command line. It is even more confusing for the case of setting CONAN_LOG_LEVEL= to an empty value (using unset CONAN_LOG_LEVEL works).

Change in behavior

a) Check the value for CONAN_LOG_LEVEL before passing its value as an argument further, and print a more informative error message. b) Allow unsetting with export CONAN_LOG_LEVEL=

Have you read the CONTRIBUTING guide?

memsharded commented 2 weeks ago

Hi @SoShiny

Thanks for your feedback

Doing https://github.com/conan-io/conan/pull/17280 to improve a bit the UX for those wrong values for CONAN_LOG_LEVEL. Planned for next 2.10 release