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

Method _fixupParents

Lib/logging/__init__.py:1413–1435  ·  view source on GitHub ↗

Ensure that there are either loggers or placeholders all the way from the specified logger to the root of the logger hierarchy.

(self, alogger)

Source from the content-addressed store, hash-verified

1411 self.logRecordFactory = factory
1412
1413 def _fixupParents(self, alogger):
1414 """
1415 Ensure that there are either loggers or placeholders all the way
1416 from the specified logger to the root of the logger hierarchy.
1417 """
1418 name = alogger.name
1419 i = name.rfind(".")
1420 rv = None
1421 while (i > 0) and not rv:
1422 substr = name[:i]
1423 if substr not in self.loggerDict:
1424 self.loggerDict[substr] = PlaceHolder(alogger)
1425 else:
1426 obj = self.loggerDict[substr]
1427 if isinstance(obj, Logger):
1428 rv = obj
1429 else:
1430 assert isinstance(obj, PlaceHolder)
1431 obj.append(alogger)
1432 i = name.rfind(".", 0, i - 1)
1433 if not rv:
1434 rv = self.root
1435 alogger.parent = rv
1436
1437 def _fixupChildren(self, ph, alogger):
1438 """

Callers 1

getLoggerMethod · 0.95

Calls 3

PlaceHolderClass · 0.85
rfindMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected