Minor style update

This commit is contained in:
Miroslav Stampar
2018-07-05 14:21:32 +02:00
parent 57be1856a6
commit 4ecf6eee05
3 changed files with 15 additions and 4 deletions

View File

@@ -150,7 +150,7 @@ class ColorizingStreamHandler(logging.StreamHandler):
else:
prefix = ""
match = re.search(r"\[([A-Z]+)\]", message)
match = re.search(r"\[([A-Z ]+)\]", message)
if match:
level = match.group(1)
if message.startswith("\x1b[1m"):
@@ -174,6 +174,17 @@ class ColorizingStreamHandler(logging.StreamHandler):
reset = self.reset
message = message.replace(time, ''.join((self.csi, str(self.color_map["cyan"] + 30), 'm', time, reset)), 1)
match = re.search(r"\[(#\d+)\]", message)
if match:
counter = match.group(1)
if not message.endswith(self.reset):
reset = self.reset
elif message.startswith("\x1b[1m"): # bold
reset = self.reset + "\x1b[1m"
else:
reset = self.reset
message = message.replace(counter, ''.join((self.csi, str(self.color_map["yellow"] + 30), 'm', counter, reset)), 1)
return message
def format(self, record):