MCPcopy Create free account
hub / github.com/EasyIME/PIME / LogCounter

Class LogCounter

python/python3/tornado/test/runtests.py:83–97  ·  view source on GitHub ↗

Counts the number of WARNING or higher log records.

Source from the content-addressed store, hash-verified

81
82
83class LogCounter(logging.Filter):
84 """Counts the number of WARNING or higher log records."""
85
86 def __init__(self, *args, **kwargs):
87 super().__init__(*args, **kwargs)
88 self.info_count = self.warning_count = self.error_count = 0
89
90 def filter(self, record):
91 if record.levelno >= logging.ERROR:
92 self.error_count += 1
93 elif record.levelno >= logging.WARNING:
94 self.warning_count += 1
95 elif record.levelno >= logging.INFO:
96 self.info_count += 1
97 return True
98
99
100class CountingStderr(io.IOBase):

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by 1

mainFunction · 0.68