1
0
Fork 0
forked from github/pelican

Merge pull request #2753 from avaris/log-dict

Fix dictionary logging in formatter
This commit is contained in:
Justin Mayer 2020-05-10 07:32:54 +02:00 committed by GitHub
commit ca1c58e201
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 108 additions and 43 deletions

View file

@ -208,6 +208,15 @@ class LogCountHandler(BufferingHandler):
(level is None or l.levelno == level)
])
def count_formatted_logs(self, msg=None, level=None):
return len([
l
for l
in self.buffer
if (msg is None or re.search(msg, self.format(l))) and
(level is None or l.levelno == level)
])
class LoggedTestCase(unittest.TestCase):
"""A test case that captures log messages."""