-L<level> will act as logging.basicConfig(level=level), but on a temporary basis, much like -W sets warning's filters.

If you don't setup logging, or don't want to (cause you're checking some library functions), this will be super handy.

If you do setup logging, it has the same caveats as setting the warning system after you passed -W. (There will be a duplicate handler).

Keep in mind that if you already had loggers with handlers set up, you won't need to use this flag, much like if you modified the default warnings you won't set -W.

It's main use is for debugging purposes in the absent or in addition of logging configuration.

On Fri, Feb 21, 2020, 7:51 PM Mike Miller <python-ideas@mgmiller.net> wrote:

On 2020-02-21 08:45, jdveiga@gmail.com wrote:
> Nice idea... in principle.
> But, what if my program has several loggers with several handlers each having its own logging info level? Would the Python's interpreter CLI argument (or the ENV variable) override all loggers and handlers logging levels? Why should CLI / ENV override those loggers and handlers?

I believe that if you've already set up comprehensive logging, this technique is
not needed.  Sometimes such a set up can handle basicConfig() being called
early, sometimes not.  But it's optional, not default behavior.

My understanding of the use case is one wants to see additional debug logs from
project and dependencies without having to set up logging first.

Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-leave@python.org
Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/BZZ5POLPWQXL3N6AGIKVSC7QJKFBJV74/
Code of Conduct: http://python.org/psf/codeofconduct/