MCPcopy Index your code
hub / github.com/python/cpython / getLevelName

Function getLevelName

Lib/logging/__init__.py:126–151  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

124 return _nameToLevel.copy()
125
126def 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
153def addLevelName(level, levelName):
154 """

Callers 6

__init__Method · 0.85
__repr__Method · 0.85
__repr__Method · 0.85
__repr__Method · 0.85
__repr__Method · 0.85
__repr__Method · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…