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

Class _CapturingHandler

Lib/unittest/_log.py:10–25  ·  view source on GitHub ↗

A logging handler capturing all (raw and formatted) logging output.

Source from the content-addressed store, hash-verified

8 ["records", "output"])
9
10class _CapturingHandler(logging.Handler):
11 """
12 A logging handler capturing all (raw and formatted) logging output.
13 """
14
15 def __init__(self):
16 logging.Handler.__init__(self)
17 self.watcher = _LoggingWatcher([], [])
18
19 def flush(self):
20 pass
21
22 def emit(self, record):
23 self.watcher.records.append(record)
24 msg = self.format(record)
25 self.watcher.output.append(msg)
26
27
28class _AssertLogsContext(_BaseTestCaseContext):

Callers 1

__enter__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…