Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 31ceb0c

Browse files
committed
Fix for an Issue #140
1 parent fec8a5c commit 31ceb0c

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

lib/core/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ def setColor(message, bold=False):
701701
retVal = message
702702
level = extractRegexResult(r"\[(?P<result>[A-Z ]+)\]", message) or kb.get("stickyLevel")
703703

704-
if message and hasattr(LOGGER_HANDLER, "level_map"): # colorizing handler
704+
if message and getattr(LOGGER_HANDLER, "is_tty", False): # colorizing handler
705705
if bold:
706706
retVal = colored(message, color=None, on_color=None, attrs=("bold",))
707707
elif level:

thirdparty/ansistrm/ansistrm.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ def emit(self, record):
5151
stream = self.stream
5252

5353
if not self.is_tty:
54+
if message and message[0] == "\r":
55+
message = message[1:]
5456
stream.write(message)
5557
else:
5658
self.output_colorized(message)
@@ -122,7 +124,7 @@ def output_colorized(self, message):
122124
ctypes.windll.kernel32.SetConsoleTextAttribute(h, color)
123125

124126
def colorize(self, message, record):
125-
if record.levelno in self.level_map:
127+
if record.levelno in self.level_map and self.is_tty:
126128
bg, fg, bold = self.level_map[record.levelno]
127129
params = []
128130

0 commit comments

Comments
 (0)