@@ -1113,18 +1113,27 @@ functions.
11131113
11141114.. function :: getLevelName(level)
11151115
1116- Returns the textual representation of logging level *level *. If the level is one
1117- of the predefined levels :const: `CRITICAL `, :const: `ERROR `, :const: `WARNING `,
1118- :const: `INFO ` or :const: `DEBUG ` then you get the corresponding string. If you
1119- have associated levels with names using :func: `addLevelName ` then the name you
1120- have associated with *level * is returned. If a numeric value corresponding to one
1121- of the defined levels is passed in, the corresponding string representation is
1122- returned. Otherwise, the string 'Level %s' % level is returned.
1116+ Returns the textual or numeric representation of logging level *level *.
1117+
1118+ If *level * is one of the predefined levels :const: `CRITICAL `, :const: `ERROR `,
1119+ :const: `WARNING `, :const: `INFO ` or :const: `DEBUG ` then you get the
1120+ corresponding string. If you have associated levels with names using
1121+ :func: `addLevelName ` then the name you have associated with *level * is
1122+ returned. If a numeric value corresponding to one of the defined levels is
1123+ passed in, the corresponding string representation is returned.
1124+
1125+ The *level * parameter also accepts a string representation of the level such
1126+ as 'INFO'. In such cases, this functions returns the corresponding numeric
1127+ value of the level.
1128+
1129+ If no matching numeric or string value is passed in, the string
1130+ 'Level %s' % level is returned.
11231131
11241132 .. note :: Levels are internally integers (as they need to be compared in the
11251133 logging logic). This function is used to convert between an integer level
11261134 and the level name displayed in the formatted log output by means of the
1127- ``%(levelname)s `` format specifier (see :ref: `logrecord-attributes `).
1135+ ``%(levelname)s `` format specifier (see :ref: `logrecord-attributes `), and
1136+ vice versa.
11281137
11291138 .. versionchanged :: 3.4
11301139 In Python versions earlier than 3.4, this function could also be passed a
0 commit comments