bpo-37742: Return the root logger when logging.getLogger('root') is c… (#15077)

* bpo-37742: Return the root logger when logging.getLogger('root') is called.

* Added type check guard on logger name in logging.getLogger() and refined a test.
This commit is contained in:
Vinay Sajip 2019-08-02 16:53:00 +01:00 committed by GitHub
parent 854d0a4b98
commit cb65b3a4f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 3 deletions

View file

@ -2024,10 +2024,9 @@ def getLogger(name=None):
If no name is specified, return the root logger.
"""
if name:
return Logger.manager.getLogger(name)
else:
if not name or isinstance(name, str) and name == root.name:
return root
return Logger.manager.getLogger(name)
def critical(msg, *args, **kwargs):
"""