MCPcopy Index your code
hub / github.com/RustPython/RustPython / Manager

Class Manager

Lib/logging/__init__.py:1338–1457  ·  view source on GitHub ↗

There is [under normal circumstances] just one Manager instance, which holds the hierarchy of loggers.

Source from the content-addressed store, hash-verified

1336 return _loggerClass
1337
1338class Manager(object):
1339 """
1340 There is [under normal circumstances] just one Manager instance, which
1341 holds the hierarchy of loggers.
1342 """
1343 def __init__(self, rootnode):
1344 """
1345 Initialize the manager with the root node of the logger hierarchy.
1346 """
1347 self.root = rootnode
1348 self.disable = 0
1349 self.emittedNoHandlerWarning = False
1350 self.loggerDict = {}
1351 self.loggerClass = None
1352 self.logRecordFactory = None
1353
1354 @property
1355 def disable(self):
1356 return self._disable
1357
1358 @disable.setter
1359 def disable(self, value):
1360 self._disable = _checkLevel(value)
1361
1362 def getLogger(self, name):
1363 """
1364 Get a logger with the specified name (channel name), creating it
1365 if it doesn't yet exist. This name is a dot-separated hierarchical
1366 name, such as "a", "a.b", "a.b.c" or similar.
1367
1368 If a PlaceHolder existed for the specified name [i.e. the logger
1369 didn't exist but a child of it did], replace it with the created
1370 logger and fix up the parent/child references which pointed to the
1371 placeholder to now point to the logger.
1372 """
1373 rv = None
1374 if not isinstance(name, str):
1375 raise TypeError('A logger name must be a string')
1376 with _lock:
1377 if name in self.loggerDict:
1378 rv = self.loggerDict[name]
1379 if isinstance(rv, PlaceHolder):
1380 ph = rv
1381 rv = (self.loggerClass or _loggerClass)(name)
1382 rv.manager = self
1383 self.loggerDict[name] = rv
1384 self._fixupChildren(ph, rv)
1385 self._fixupParents(rv)
1386 else:
1387 rv = (self.loggerClass or _loggerClass)(name)
1388 rv.manager = self
1389 self.loggerDict[name] = rv
1390 self._fixupParents(rv)
1391 return rv
1392
1393 def setLoggerClass(self, klass):
1394 """
1395 Set the class to be used when instantiating a logger with this Manager.

Callers 1

__init__.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected