summaryrefslogtreecommitdiffstats
path: root/Lib/logging
diff options
context:
space:
mode:
authorandrei kulakov <andrei.avk@gmail.com>2021-06-03 08:12:59 (GMT)
committerGitHub <noreply@github.com>2021-06-03 08:12:59 (GMT)
commit8b93f0e696d3fc60fd311c13d5238da73a35e3b3 (patch)
tree0d1b5fd01fe4c7ab9ee1c38b801274a085bd7c4a /Lib/logging
parent4846ea95d1a121df5e8081e2a290f63d1419cad8 (diff)
downloadcpython-8b93f0e696d3fc60fd311c13d5238da73a35e3b3.zip
cpython-8b93f0e696d3fc60fd311c13d5238da73a35e3b3.tar.gz
cpython-8b93f0e696d3fc60fd311c13d5238da73a35e3b3.tar.bz2
bpo-43858: Add logging.getLevelNamesMapping() (GH-26459)
Added a function that returns a copy of a dict of logging levels.
Diffstat (limited to 'Lib/logging')
-rw-r--r--Lib/logging/__init__.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py
index 7865b71..3538f06 100644
--- a/Lib/logging/__init__.py
+++ b/Lib/logging/__init__.py
@@ -37,7 +37,7 @@ __all__ = ['BASIC_FORMAT', 'BufferingFormatter', 'CRITICAL', 'DEBUG', 'ERROR',
'exception', 'fatal', 'getLevelName', 'getLogger', 'getLoggerClass',
'info', 'log', 'makeLogRecord', 'setLoggerClass', 'shutdown',
'warn', 'warning', 'getLogRecordFactory', 'setLogRecordFactory',
- 'lastResort', 'raiseExceptions']
+ 'lastResort', 'raiseExceptions', 'getLevelNamesMapping']
import threading
@@ -116,6 +116,9 @@ _nameToLevel = {
'NOTSET': NOTSET,
}
+def getLevelNamesMapping():
+ return _nameToLevel.copy()
+
def getLevelName(level):
"""
Return the textual or numeric representation of logging level 'level'.