From ac33f237463dfab6d324d33ac6f7c3f22a8c4683 Mon Sep 17 00:00:00 2001 From: John Siirola Date: Wed, 17 Jun 2020 10:43:45 -0600 Subject: [PATCH] Log formatter should not combine lines starting "[\s*\S+\s*]" --- pyutilib/misc/log_config.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pyutilib/misc/log_config.py b/pyutilib/misc/log_config.py index 04de48a3..788b0c60 100644 --- a/pyutilib/misc/log_config.py +++ b/pyutilib/misc/log_config.py @@ -13,6 +13,7 @@ import textwrap _indention = re.compile('\s*') +_status_re = re.compile('^\[\s*[A-Za-z0-9\.]+\s*\]') class LogHandler(logging.Handler): @@ -74,9 +75,10 @@ def emit(self, record): # Blank lines reset the indentation level indent = None elif indent == leading: - # Catch things like bulleted lists - if len(content) > 1 and par_lines and content[1] == ' ' \ - and content[0] in '-* ': + # Catch things like bulleted lists and '[FAIL]' + if len(content) > 1 and par_lines and ( + (content[1] == ' ' and content[0] in '-* ') or + (content[0] == '[' and _status_re.match(content))): paragraphs.append((indent, par_lines)) par_lines = [] par_lines.append( content )