MCPcopy Index your code
hub / github.com/python/cpython / getLogger

Method getLogger

Lib/logging/__init__.py:1365–1394  ·  view source on GitHub ↗

Get a logger with the specified name (channel name), creating it if it doesn't yet exist. This name is a dot-separated hierarchical name, such as "a", "a.b", "a.b.c" or similar. If a PlaceHolder existed for the specified name [i.e. the logger didn't exist bu

(self, name)

Source from the content-addressed store, hash-verified

1363 self._disable = _checkLevel(value)
1364
1365 def getLogger(self, name):
1366 """
1367 Get a logger with the specified name (channel name), creating it
1368 if it doesn't yet exist. This name is a dot-separated hierarchical
1369 name, such as "a", "a.b", "a.b.c" or similar.
1370
1371 If a PlaceHolder existed for the specified name [i.e. the logger
1372 didn't exist but a child of it did], replace it with the created
1373 logger and fix up the parent/child references which pointed to the
1374 placeholder to now point to the logger.
1375 """
1376 rv = None
1377 if not isinstance(name, str):
1378 raise TypeError('A logger name must be a string')
1379 with _lock:
1380 if name in self.loggerDict:
1381 rv = self.loggerDict[name]
1382 if isinstance(rv, PlaceHolder):
1383 ph = rv
1384 rv = (self.loggerClass or _loggerClass)(name)
1385 rv.manager = self
1386 self.loggerDict[name] = rv
1387 self._fixupChildren(ph, rv)
1388 self._fixupParents(rv)
1389 else:
1390 rv = (self.loggerClass or _loggerClass)(name)
1391 rv.manager = self
1392 self.loggerDict[name] = rv
1393 self._fixupParents(rv)
1394 return rv
1395
1396 def setLoggerClass(self, klass):
1397 """

Callers 15

glossary_search.pyFile · 0.80
pydoc_topics.pyFile · 0.80
availability.pyFile · 0.80
audit_events.pyFile · 0.80
log.pyFile · 0.80
_debugFunction · 0.80
_install_loggersFunction · 0.80
configure_loggerMethod · 0.80
configure_rootMethod · 0.80
getChildMethod · 0.80
getLoggerFunction · 0.80

Calls 2

_fixupChildrenMethod · 0.95
_fixupParentsMethod · 0.95

Tested by 15

setUpMethod · 0.64
_test_urlsMethod · 0.64
tearDownModuleFunction · 0.64
_caplogFunction · 0.64
test_levelMethod · 0.64
setUpMethod · 0.64
tearDownMethod · 0.64
test_flatMethod · 0.64
test_nested_explicitMethod · 0.64
test_nested_inheritedMethod · 0.64