This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author cboylan
Recipients cboylan
Date 2014-09-11.01:09:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1410397798.62.0.061648555693.issue22386@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2014-09-11 01:09:58cboylansetrecipients: + cboylan
2014-09-11 01:09:58cboylansetmessageid: <1410397798.62.0.061648555693.issue22386@psf.upfronthosting.co.za>
2014-09-11 01:09:58cboylanlinkissue22386 messages
2014-09-11 01:09:56cboylancreate