Did this idea ever went anywhere? I thought I saw a bpo issue for this but I can't find it anymore and it's not present in 3.8 or 3.9 NEWS nor in master as far as I can tell.
I think it would be very useful, while it's possible to use argparse to have an argument to set it I've found that many novice users are afraid of logging and its various options, having to use argparse on top of it adds a layer of complexity so most of the time thay either just put print() everywhere, or hardcode the log level in their program making it complicated to change later.
I usually start my scripts with:
but as everybody use a different environment variable or command line option it's not obvious how to set the log level for a given program without looking at its source code.
Also I would like to add both an -L option and a PYTHONLOGGING environment variable. The command line option seems better when possible but when it's not possible to use it, either because the script uses a shebang, or because the command line arguments are not accessible (e.g. a lambda function on a cloud environment) being able to use the environment variable would be a nice alternative. Yes, it should not be set as a global variable environment but so should not PYTHONHASHSEED or PYTHONMALLOC.
Sorry for the noise if this has already been implemented, if not I can start working on it.
Python-ideas mailing list -- firstname.lastname@example.org
To unsubscribe send an email to email@example.com
Message archived at https://firstname.lastname@example.org/message/BVUMURTEZFQG36HRCZYRSWJK6OTZIBZG/
Code of Conduct: http://python.org/psf/codeofconduct/