Calculate the logging level from the --verbose option count

By ubaumann, Sat 31 July 2021, modified Sat 31 July 2021, in category Brief Byte

Python

Many CLI tools allow you to increase the verbosity level several times using the --verbose|-v option. Counting the options and calculating the logging level is easy.

level = 10 * (4 - max(0, min(verbose, 4)))

small cli tool to print the verbose level

example using the cli tool