Return the textual or numeric representation of logging level 'level'. If the level is one of the predefined levels (CRITICAL, ERROR, WARNING, INFO, DEBUG) then you get the corresponding string. If you have associated levels with names using addLevelName then the name you have
(level)
| 124 | return _nameToLevel.copy() |
| 125 | |
| 126 | def getLevelName(level): |
| 127 | """ |
| 128 | Return the textual or numeric representation of logging level 'level'. |
| 129 | |
| 130 | If the level is one of the predefined levels (CRITICAL, ERROR, WARNING, |
| 131 | INFO, DEBUG) then you get the corresponding string. If you have |
| 132 | associated levels with names using addLevelName then the name you have |
| 133 | associated with 'level' is returned. |
| 134 | |
| 135 | If a numeric value corresponding to one of the defined levels is passed |
| 136 | in, the corresponding string representation is returned. |
| 137 | |
| 138 | If a string representation of the level is passed in, the corresponding |
| 139 | numeric value is returned. |
| 140 | |
| 141 | If no matching numeric or string value is passed in, the string |
| 142 | 'Level %s' % level is returned. |
| 143 | """ |
| 144 | # See Issues #22386, #27937 and #29220 for why it's this way |
| 145 | result = _levelToName.get(level) |
| 146 | if result is not None: |
| 147 | return result |
| 148 | result = _nameToLevel.get(level) |
| 149 | if result is not None: |
| 150 | return result |
| 151 | return "Level %s" % level |
| 152 | |
| 153 | def addLevelName(level, levelName): |
| 154 | """ |