We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The task is to make Python logging logger.setLevel() accept lowercase string. It already accepts uppercase 'DEBUG' string.
logging
logger.setLevel()
import logging logger = logging.getLogger(__name__) handler = logging.StreamHandler() logger.addHandler(handler) logger.setLevel('DEBUG') logger.debug('!!!')
Modifications need to be done to _checkLevel function.
_checkLevel
https://github.com/python/cpython/blob/8c0f0016e2d39f86589187db75012238c4e760e9/Lib/logging/__init__.py#L189-L198
def _checkLevel(level): if isinstance(level, int): rv = level elif str(level) == level: if level not in _nameToLevel: raise ValueError("Unknown level: %r" % level) rv = _nameToLevel[level] else: raise TypeError("Level not an integer or a valid string: %r" % level) return rv
The text was updated successfully, but these errors were encountered:
Docs: https://docs.python.org/3/library/logging.html#logging.Logger.setLevel
Sorry, something went wrong.
No branches or pull requests
The task is to make Python
logging
logger.setLevel()
accept lowercase string. It already accepts uppercase 'DEBUG' string.Modifications need to be done to
_checkLevel
function.https://github.com/python/cpython/blob/8c0f0016e2d39f86589187db75012238c4e760e9/Lib/logging/__init__.py#L189-L198
The text was updated successfully, but these errors were encountered: