
Hey Remi, I've started working on it the other day, but unfortunately had difficulties with my development environment after suffering a hard drive failure. Haven't tried again since then. I've opened a quick bpo - 40886. Since my dev environment is still messed up and VStudio kills me with obscure error messages, you're welcome to give it a go :-) Thank you for being awesome! Bar Harel On Sat, Jun 6, 2020 at 1:40 AM <remi.lapeyre@henki.fr> wrote:
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:
logging.basicConfig(level=os.environ.get('LOG_LEVEL', 'INFO'))
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.
Rémi _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-leave@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/BVUMUR... Code of Conduct: http://python.org/psf/codeofconduct/