The logging module has several attributes that allow you to use this function. They are prefixed with an underline that implies confidentiality, so using them is not a good idea. But:
At the highest level, there is _checkLevel , which takes a level that is either a string or an integer, and either returns the corresponding existing level or raises a ValueError .
_checkLevel completes the _checkLevel dictionary, which contains all registered levels (and addLevelName updated).
There is an additional element called _levelToName that contains the inverse mapping. This is publicly available using the getLevelName method.
source share