# assuming loglevel is bound to the string value obtained from the
# command line argument. Convert to upper case to allow the user to
# specify --log=DEBUG or --log=debug
numeric_level = getattr(logging, loglevel.upper(), None)
if not isinstance(numeric_level, int):
raise ValueError('Invalid log level: %s' % loglevel)
logging.basicConfig(level=numeric_level, ...)
Which allows us to pass the desired logging level as cmd line option.
Problem
Our logging system is not as good as it could be.
Proposed Solution
I propose doing something like this:
Which allows us to pass the desired logging level as cmd line option.
See more context on how to implement it here: https://docs.python.org/3/howto/logging.html