> > > If you want it only temporarily for debugging purposes, or permanently > for all scripts in your system, it's not really feasible. > > Hmm, I'm not sure that I like the idea of overriding the default logging > level being set system-wide, or that there would be an especially strong > use case for it. Instead, it seems more practically common to want to set > it on an individual run of a program temporarily. In such cases, using some > form of command-line parsing utility is a perfectly a viable option. >
Well I meant more like a permanent "debug" mode, but the temporary case is probably the one more appealing to me and other users. > > We have debugging flags for warnings, faulthandlers, asyncio etc... > Arguably though, the easier it is to implement on your own, the less of a > need there is to be an environment variable to do it. Also, I think the > logging configuration should be on a per-program basis, rather than > globally (which is what env vars are typically used for). > I agree that logging configuration should be on a per program basis. Maybe a flag should be the solution, like '-Linfo'. When I said 'trivial', I didn't mean easy to implement. I meant that it's a much more common use case, and makes sense to have. -Wdefault is trivial to implement. Asyncio.debug is a single flag. Logging takes the same amount of lines, even more if you need to parse the args, but is much more common and needed. I've done a little stack overflow search, and there are tons of questions about having or creating such a feature manually. Last but not least: our suggested methodology for libraries is to use "NullHandler". If a library uses it, errors will not show up unless you set up a handler (with probably stdout for debug) on the root logger. If '-Linfo' or '-x logging' will be part of the possible debug cmdline options, these obscure bugs would be much easier to track. (I personally spent a few days to track one like that not long ago)
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@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/BETDBL6LWQ3IV6PHI4OL52PWWGRCNXAE/ Code of Conduct: http://python.org/psf/codeofconduct/