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"],
type=str.upper

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...
type. 

When I don't need that level of detail I use

level = logging.DEBUG if args.verbose else logging.ERROR

or similar.

> Or should I accept both numbers and these string constants?

Well, I don't even remember those numbers ;)

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to