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.

classification
Title: Document that logging.getLevelName() can return a numeric value.
Type: enhancement Stage: resolved
Components: Documentation, Library (Lib) Versions: Python 3.10, Python 3.9, Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, eamanu, fdrake, felixxm, miss-islington, vinay.sajip
Priority: normal Keywords: patch

Created on 2021-03-01 12:00 by felixxm, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 24693 merged felixxm, 2021-03-01 21:37
PR 24825 merged felixxm, 2021-03-11 20:35
PR 24826 merged felixxm, 2021-03-11 20:36
Messages (11)
msg387856 - (view) Author: Mariusz Felisiak (felixxm) * Date: 2021-03-01 12:00
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
msg387872 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2021-03-01 15:17
Sure, I'll look at a PR that mentions the other usage above the "changed in 3.4" section.
msg387878 - (view) Author: Emmanuel Arias (eamanu) * Date: 2021-03-01 19:25
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
msg388261 - (view) Author: miss-islington (miss-islington) Date: 2021-03-08 11:16
New changeset bbba28212ce0f58096a4043f32442c6e727b74fc by Mariusz Felisiak in branch 'master':
bpo-43353: Document that logging.getLevelName() accepts string representation of logging level. (GH-24693)
https://github.com/python/cpython/commit/bbba28212ce0f58096a4043f32442c6e727b74fc
msg388445 - (view) Author: Mariusz Felisiak (felixxm) * Date: 2021-03-10 17:18
Do we want to backport this patch? If yes, I can prepare backports. If not, we can close the ticket.
msg388446 - (view) Author: Fred Drake (fdrake) (Python committer) Date: 2021-03-10 17:25
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:
https://github.com/python/cpython/commit/bbba28212ce0f58096a4043f32442c6e727b74fc#diff-1bf0ad6d121df3948853dafdd8e5406709fe0c3911b30e3cf2def41717455c98R121

Otherwise, I do believe this should be back-ported.
msg388448 - (view) Author: Mariusz Felisiak (felixxm) * Date: 2021-03-10 18:00
"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
msg388449 - (view) Author: Fred Drake (fdrake) (Python committer) Date: 2021-03-10 18:04
Mariusz: Good point.  IMO, an insane API behavior, but a legacy we must live with.

No further objections from me.
msg388523 - (view) Author: Mariusz Felisiak (felixxm) * Date: 2021-03-11 20:38
I've prepared PRs with backports.
msg388536 - (view) Author: miss-islington (miss-islington) Date: 2021-03-12 08:46
New changeset 4d7f11e05731f67fd2c07ec2972c6cb9861d52be 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)
https://github.com/python/cpython/commit/4d7f11e05731f67fd2c07ec2972c6cb9861d52be
msg388918 - (view) Author: Fred Drake (fdrake) (Python committer) Date: 2021-03-17 12:16
New changeset 9bdb5802361016704fb3434369741cc6c5e08f02 by Mariusz Felisiak in branch '3.8':
bpo-43353: Document that logging.getLevelName() accepts string representation of logging level. (GH-24693) (#24825)
https://github.com/python/cpython/commit/9bdb5802361016704fb3434369741cc6c5e08f02
History
Date User Action Args
2022-04-11 14:59:42adminsetgithub: 87519
2021-03-17 12:18:34felixxmsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2021-03-17 12:16:09fdrakesetmessages: + msg388918
2021-03-12 08:46:35miss-islingtonsetmessages: + msg388536
2021-03-11 20:38:02felixxmsetmessages: + msg388523
2021-03-11 20:36:55felixxmsetpull_requests: + pull_request23591
2021-03-11 20:35:46felixxmsetpull_requests: + pull_request23590
2021-03-10 18:04:55fdrakesetmessages: + msg388449
2021-03-10 18:00:16felixxmsetmessages: + msg388448
2021-03-10 17:25:29fdrakesetnosy: + fdrake
messages: + msg388446
2021-03-10 17:18:01felixxmsetmessages: + msg388445
2021-03-08 11:16:38miss-islingtonsetnosy: + miss-islington
messages: + msg388261
2021-03-01 21:37:35felixxmsetkeywords: + patch
stage: patch review
pull_requests: + pull_request23471
2021-03-01 19:25:15eamanusetassignee: docs@python
type: enhancement
components: + Documentation
versions: + Python 3.8, Python 3.9, Python 3.10
nosy: + eamanu, docs@python

messages: + msg387878
2021-03-01 15:17:05vinay.sajipsetmessages: + msg387872
2021-03-01 12:00:00felixxmcreate