New submission from Clark Boylan: Prior to http://hg.python.org/cpython/rev/5629bf4c6bba?revcount=60 logging.getLevelName(lvl) would map string lvl args like 'INFO' to the integer level value 20. After this change the string to int level mapping is removed and you can only map level to string. This removes the only public method for doing this mapping in the logging module.
Old Behavior: >>> logging.getLevelName('INFO') 20 >>> logging.getLevelName(20) 'INFO' >>> New Behavior: >>> logging.getLevelName('INFO') 'Level INFO' >>> logging.getLevelName(20) 'INFO' >>> logging.getLevelName(logging.INFO) 'INFO' >>> The old behavior is valuable because it allows you to sanity check log levels provided as strings before attempting to use them. It seems that without this public mapping you have to rely on Logger.setLevel(lvl) throwing a ValueError which it seems to do only in 2.7 and greater. ---------- components: Library (Lib) messages: 226739 nosy: cboylan priority: normal severity: normal status: open title: Python 3.4 logging.getLevelName() no longer maps string to level. type: behavior versions: Python 3.4 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue22386> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com