][Thread Next][Date Index
Recommended format for --log-level option
Victor Porton wrote:
> What is the recommended format for --log-level (or --loglevel?) command
> line option?
> Is it a number or NOTSET|DEBUG|INFO|WARNING|ERROR|CRITICAL?
Not really a recommendation, but I use
choices=["DEBUG", ..., "CRITICAL"],
It's not clear to me what it means to set the logging level to NOTSET, so I
left that one out. The type allows me to invoke the script
./script.py --log-level warning
which I find more convenient to...
When I don't need that level of detail I use
level = logging.DEBUG if args.verbose else logging.ERROR
> Or should I accept both numbers and these string constants?
Well, I don't even remember those numbers ;)