2
0
mirror of https://github.com/mbusb/multibootusb synced 2024-11-01 15:40:16 +00:00

remove ANSI color codes from log file

This commit is contained in:
Alin Trăistaru 2017-04-28 22:03:41 +03:00
parent bdccb95396
commit 580cb84d3b

View File

@ -43,12 +43,16 @@ def log(message, info=True, error=False, debug=False):
datefmt='%H:%M:%S', datefmt='%H:%M:%S',
level=logging.DEBUG) level=logging.DEBUG)
print(message) print(message)
# remove ANSI color codes from logs
message_clean = re.compile(r'\x1b[^m]*m').sub('', message)
if info is True: if info is True:
logging.info(message) logging.info(message_clean)
elif error is not False: elif error is not False:
logging.error(message) logging.error(message_clean)
elif debug is not False: elif debug is not False:
logging.debug(message) logging.debug(message_clean)
def resource_path(relativePath): def resource_path(relativePath):