Add a method to list the current named logging levels

Mats Wichmann mats at wichmann.us
Wed Mar 30 14:34:06 EDT 2022


On 3/30/22 10:39, Chris Angelico wrote:

> New in 3.11:
> 
> https://docs.python.org/3.11/library/logging.html#logging.getLevelNamesMapping
> 
> I'd say it's reasonable to use this, and then to backport it to older
> versions by monkeypatching it in (by referencing the internal). You
> potentially might have issues with other Python implementations, but
> I'm pretty sure CPython has logging._nameToLevel with the same
> semantics for quite a while.

since 2013, it looks like.




More information about the Python-list mailing list