forked from github/pelican
Fix dictionary logging in formatter
Python special cases single Mapping arguments to logging. This adjusts BaseFormatter to skip "fancy" formatting if argument is of type Mapping. Also adds various formatted log outputs.
This commit is contained in:
parent
c19075816b
commit
50281c42e5
3 changed files with 63 additions and 3 deletions
|
|
@ -195,6 +195,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."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue