[issue32559] logging - public function to get level from name

2018-01-16 Thread Vinay Sajip
Vinay Sajip added the comment: I don't think a strong enough case has been made for adding this enhancement. -- resolution: -> rejected stage: -> resolved status: open -> closed ___ Python tracker

[issue32559] logging - public function to get level from name

2018-01-16 Thread Raymond Hettinger
Raymond Hettinger added the comment: > The request is not to set the level but to get the level > given the level name aka textual representation. > For example, passing in INFO should return 20 and passing > in CRITICAL should return 50. Why do we care about

[issue32559] logging - public function to get level from name

2018-01-16 Thread Varun Agrawal
Varun Agrawal added the comment: @zach.ware: True, but since we already have a getLevelName method, having a symmetric method to do the opposite made sense. Plus the method can perform error checking and other things to ensure much cleaner code. --

[issue32559] logging - public function to get level from name

2018-01-16 Thread Zachary Ware
Zachary Ware added the comment: You could use `getattr(logging, levelname)` for that purpose. -- nosy: +zach.ware ___ Python tracker

[issue32559] logging - public function to get level from name

2018-01-16 Thread Varun Agrawal
Varun Agrawal added the comment: The request is not to set the level but to get the level given the level name aka textual representation. For example, passing in INFO should return 20 and passing in CRITICAL should return 50. --

[issue32559] logging - public function to get level from name

2018-01-16 Thread Raymond Hettinger
Raymond Hettinger added the comment: The use case of setting the level by name was already fulfilled in Python 3.2. The logging.setLevel() function takes either an int or a string. -- assignee: -> vinay.sajip nosy: +rhettinger, vinay.sajip priority:

[issue32559] logging - public function to get level from name

2018-01-15 Thread Varun Agrawal
New submission from Varun Agrawal : Currently, the logging module has a function `getLevelName` and directly accessing the `_nameToLevel` dict is poor practice bordering on non-pythonic. It would be nice to have a simple method like `getNameLevel` in the module to