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 serhiy.storchaka
Recipients markb, python-dev, serhiy.storchaka, vinay.sajip
Date 2017-01-11.07:25:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1484119514.7.0.812214771741.issue29220@psf.upfronthosting.co.za>
In-reply-to
Content
As for the patch itself, I would add an indentation for the second "if":

    result = _levelToName.get(level)
    if result is None:
        result = _nameToLevel.get(level)
        if result is None:
            result = "Level %s" % level
    return result

or even use multiple returns for the sake of microoptimization:

    result = _levelToName.get(level)
    if result is not None:
        return result
    result = _nameToLevel.get(level)
    if result is not None:
        return result
    return "Level %s" % level

But I'm not sure that empty name is valid. It can cause problems when parse a configuration file or logs.

I don't understand the use of _nameToLevel. getLevelName('CRITICAL') returns 50, that even is not a string.
History
Date User Action Args
2017-01-11 07:25:14serhiy.storchakasetrecipients: + serhiy.storchaka, vinay.sajip, markb, python-dev
2017-01-11 07:25:14serhiy.storchakasetmessageid: <1484119514.7.0.812214771741.issue29220@psf.upfronthosting.co.za>
2017-01-11 07:25:14serhiy.storchakalinkissue29220 messages
2017-01-11 07:25:14serhiy.storchakacreate