[issue43858] Provide method to get list of logging level names

Andrei Kulakov report at bugs.python.org
Mon May 17 17:22:42 EDT 2021


Andrei Kulakov <andrei.avk at gmail.com> added the comment:

I can add getLevelNamesDict() which would return a copy of _nameToLevel, which is currently

_nameToLevel = {
    'CRITICAL': CRITICAL,
    'FATAL': FATAL,
    'ERROR': ERROR,
    'WARN': WARNING,
    'WARNING': WARNING,
    'INFO': INFO,
    'DEBUG': DEBUG,
    'NOTSET': NOTSET,
}

I think it may be best not to return a list of levels because it's not obvious that some of them are aliases, if the caller is responsible for making the list out of the dict, they will be able to decide how to deal with alias levels.

If that sounds good I can make a PR..

----------
nosy: +andrei.avk

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43858>
_______________________________________


More information about the Python-bugs-list mailing list