Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document that logging.getLevelName() can return a numeric value. #87519

Closed
felixxm mannequin opened this issue Mar 1, 2021 · 11 comments
Closed

Document that logging.getLevelName() can return a numeric value. #87519

felixxm mannequin opened this issue Mar 1, 2021 · 11 comments
Labels
3.8 only security fixes 3.9 only security fixes 3.10 only security fixes docs Documentation in the Doc dir stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@felixxm
Copy link
Mannequin

felixxm mannequin commented Mar 1, 2021

BPO 43353
Nosy @freddrake, @vsajip, @eamanu, @miss-islington, @felixxm
PRs
  • bpo-43353: Document that logging.getLevelName() accepts string representation of logging level. #24693
  • [3.8] bpo-43353: Document that logging.getLevelName() accepts string representation of logging level. (GH-24693) #24825
  • [3.9] bpo-43353: Document that logging.getLevelName() accepts string representation of logging level. (GH-24693) #24826
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2021-03-17.12:18:34.711>
    created_at = <Date 2021-03-01.12:00:00.650>
    labels = ['3.8', '3.9', '3.10', 'type-feature', 'library', 'docs']
    title = 'Document that logging.getLevelName() can return a numeric value.'
    updated_at = <Date 2021-03-17.12:18:34.711>
    user = 'https://github.com/felixxm'

    bugs.python.org fields:

    activity = <Date 2021-03-17.12:18:34.711>
    actor = 'felixxm'
    assignee = 'docs@python'
    closed = True
    closed_date = <Date 2021-03-17.12:18:34.711>
    closer = 'felixxm'
    components = ['Documentation', 'Library (Lib)']
    creation = <Date 2021-03-01.12:00:00.650>
    creator = 'felixxm'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 43353
    keywords = ['patch']
    message_count = 11.0
    messages = ['387856', '387872', '387878', '388261', '388445', '388446', '388448', '388449', '388523', '388536', '388918']
    nosy_count = 6.0
    nosy_names = ['fdrake', 'vinay.sajip', 'docs@python', 'eamanu', 'miss-islington', 'felixxm']
    pr_nums = ['24693', '24825', '24826']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue43353'
    versions = ['Python 3.8', 'Python 3.9', 'Python 3.10']

    @felixxm
    Copy link
    Mannequin Author

    felixxm mannequin commented Mar 1, 2021

    Can we document[1] that logging.getLevelName() returns a numeric value when corresponding string is passed in (related with https://bugs.python.org/issue1008295). I know that we have "Changed in version 3.4" annotation but I think it's worth mentioning in the main description.

    I hope it's not a duplicate, I tried to find matching ticket.

    I can submit PR if accepted.

    [1] https://docs.python.org/3.10/library/logging.html?highlight=getlevelname#logging.getLevelName

    @felixxm felixxm mannequin added the stdlib Python modules in the Lib dir label Mar 1, 2021
    @vsajip
    Copy link
    Member

    vsajip commented Mar 1, 2021

    Sure, I'll look at a PR that mentions the other usage above the "changed in 3.4" section.

    @eamanu
    Copy link
    Mannequin

    eamanu mannequin commented Mar 1, 2021

    That would be great mention that! IMO This affect 3.8+? I'm not sure if docs changes are accepted to 3.6 and 3.7

    @eamanu eamanu mannequin added docs Documentation in the Doc dir 3.8 only security fixes 3.9 only security fixes 3.10 only security fixes labels Mar 1, 2021
    @eamanu eamanu mannequin assigned docspython Mar 1, 2021
    @eamanu eamanu mannequin added type-feature A feature request or enhancement 3.8 only security fixes 3.9 only security fixes 3.10 only security fixes labels Mar 1, 2021
    @eamanu eamanu mannequin assigned docspython Mar 1, 2021
    @eamanu eamanu mannequin added the type-feature A feature request or enhancement label Mar 1, 2021
    @miss-islington
    Copy link
    Contributor

    New changeset bbba282 by Mariusz Felisiak in branch 'master':
    bpo-43353: Document that logging.getLevelName() accepts string representation of logging level. (GH-24693)
    bbba282

    @felixxm
    Copy link
    Mannequin Author

    felixxm mannequin commented Mar 10, 2021

    Do we want to backport this patch? If yes, I can prepare backports. If not, we can close the ticket.

    @freddrake
    Copy link
    Member

    Just noticed this fly by in the stream of emails... sorry for not commenting earlier.

    The patch seems to describe "Level #" as "numeric", which I would not be inclined to do. It includes the numeric value since there's no available name for it, but as a value, it's still textual.

    I'm referring specifically to the change here:
    bbba282#diff-1bf0ad6d121df3948853dafdd8e5406709fe0c3911b30e3cf2def41717455c98R121

    Otherwise, I do believe this should be back-ported.

    @felixxm
    Copy link
    Mannequin Author

    felixxm mannequin commented Mar 10, 2021

    "numeric" doesn't refer to the "Level #" representation but to the fact that getLevelName() returns a numeric value when the corresponding name is passed, e.g.

    >>> getLevelName('CRITICAL') 
    50

    @freddrake
    Copy link
    Member

    Mariusz: Good point. IMO, an insane API behavior, but a legacy we must live with.

    No further objections from me.

    @felixxm
    Copy link
    Mannequin Author

    felixxm mannequin commented Mar 11, 2021

    I've prepared PRs with backports.

    @miss-islington
    Copy link
    Contributor

    New changeset 4d7f11e by Mariusz Felisiak in branch '3.9':
    [3.9] bpo-43353: Document that logging.getLevelName() accepts string representation of logging level. (GH-24693) (GH-24826)
    4d7f11e

    @freddrake
    Copy link
    Member

    New changeset 9bdb580 by Mariusz Felisiak in branch '3.8':
    bpo-43353: Document that logging.getLevelName() accepts string representation of logging level. (GH-24693) (bpo-24825)
    9bdb580

    @felixxm felixxm mannequin closed this as completed Mar 17, 2021
    @felixxm felixxm mannequin closed this as completed Mar 17, 2021
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.8 only security fixes 3.9 only security fixes 3.10 only security fixes docs Documentation in the Doc dir stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants