import logging.handlers class TestHandler(logging.handlers.BufferingHandler): def __init__(self, matcher): # BufferingHandler takes a "capacity" argument # so as to know when to flush. As we're overriding # shouldFlush anyway, we can set a capacity of zero. # You can call flush() manually to clear out the # buffer. logging.handlers.BufferingHandler.__init__(self, 0) self.matcher = matcher def shouldFlush(self): return False def emit(self, record): self.format(record) self.buffer.append(record.__dict__) def matches(self, **kwargs): """ Look for a saved dict whose keys/values match the supplied arguments. """ result = False for d in self.buffer: if self.matcher.matches(d, **kwargs): result = True break return result
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
__pycache__ | Folder | 0755 |
|
|
__init__.py | File | 69.69 KB | 0644 |
|
bytecode_helper.py | File | 1.61 KB | 0644 |
|
hashlib_helper.py | File | 1.86 KB | 0644 |
|
import_helper.py | File | 7.55 KB | 0644 |
|
interpreters.py | File | 5.69 KB | 0644 |
|
logging_helper.py | File | 916 B | 0644 |
|
os_helper.py | File | 19.5 KB | 0644 |
|
script_helper.py | File | 11.14 KB | 0644 |
|
socket_helper.py | File | 11.21 KB | 0644 |
|
testresult.py | File | 5.86 KB | 0644 |
|
threading_helper.py | File | 6.49 KB | 0644 |
|
warnings_helper.py | File | 6.44 KB | 0644 |
|