[issue43858] Provide method to get list of logging level names

2021-06-03 Thread Vinay Sajip


Change by Vinay Sajip :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
type:  -> enhancement
versions: +Python 3.11 -Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43858] Provide method to get list of logging level names

2021-06-03 Thread miss-islington


miss-islington  added the comment:


New changeset 8b93f0e696d3fc60fd311c13d5238da73a35e3b3 by andrei kulakov in 
branch 'main':
bpo-43858: Add logging.getLevelNamesMapping() (GH-26459)
https://github.com/python/cpython/commit/8b93f0e696d3fc60fd311c13d5238da73a35e3b3


--
nosy: +miss-islington

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43858] Provide method to get list of logging level names

2021-05-30 Thread Andrei Kulakov


Change by Andrei Kulakov :


--
keywords: +patch
pull_requests: +25054
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/26459

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43858] Provide method to get list of logging level names

2021-05-30 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> I can add getLevelNamesDict() which would return a copy of _nameToLevel

That seem like the best approach.

--
assignee:  -> vinay.sajip
nosy: +rhettinger

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43858] Provide method to get list of logging level names

2021-05-30 Thread Andy Lowry


Andy Lowry  added the comment:

@andrei.avk Yes, that sounds just fine. Many thanks.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43858] Provide method to get list of logging level names

2021-05-17 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

I can add getLevelNamesDict() which would return a copy of _nameToLevel, which 
is currently

_nameToLevel = {
'CRITICAL': CRITICAL,
'FATAL': FATAL,
'ERROR': ERROR,
'WARN': WARNING,
'WARNING': WARNING,
'INFO': INFO,
'DEBUG': DEBUG,
'NOTSET': NOTSET,
}

I think it may be best not to return a list of levels because it's not obvious 
that some of them are aliases, if the caller is responsible for making the list 
out of the dict, they will be able to decide how to deal with alias levels.

If that sounds good I can make a PR..

--
nosy: +andrei.avk

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43858] Provide method to get list of logging level names

2021-04-15 Thread Eric V. Smith


Change by Eric V. Smith :


--
nosy: +vinay.sajip

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43858] Provide method to get list of logging level names

2021-04-15 Thread Eric V. Smith


Change by Eric V. Smith :


--
nosy: +eric.smith

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43858] Provide method to get list of logging level names

2021-04-15 Thread Shreyan Avigyan


Shreyan Avigyan  added the comment:

I agree with you. It would be nice to have a function to list or dictionary of 
level names. Moreover I suggest that there should be an argument to the 
function like format_level which can take in "dict:level_name" for returning a 
dictionary with the level as keys and name as values, "dict:name_level" for 
returning a dictionary with the name as keys and level as values or "list" for 
returning just the list of level names ordered by priority.

--
nosy: +shreyanavigyan

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43858] Provide method to get list of logging level names

2021-04-15 Thread Andy Lowry


New submission from Andy Lowry :

It would be useful to have something like a `getLevelNames` method to return 
the current list of level names, ordered by priority.

This currently appears to be available only by accessing a private member, like 
`_levelToName` or `_nameToLevel`.

This functionality is useful, for example, in populating a `choices` list for 
an `argparse` option to allow a user to select a logging level when launching a 
program from a command line.

--
components: Library (Lib)
messages: 391145
nosy: andylowry
priority: normal
severity: normal
status: open
title: Provide method to get list of logging level names
versions: Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com