log._clean_str_regex: Fix missing r-qualifier

Fix missing raw string qualifier missing from regex with backslashes.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2025-11-02 09:41:14 +01:00
commit e071df39ab

View file

@ -30,7 +30,7 @@ _special_chars = {
_special_char_regex = re.compile("(%s)" % "|".join(map(re.escape, _special_chars.keys()))) _special_char_regex = re.compile("(%s)" % "|".join(map(re.escape, _special_chars.keys())))
_all_control_chars = ''.join(chr(c) for c in range(sys.maxunicode) if unicodedata.category(chr(c)) in {'Cc'}) _all_control_chars = ''.join(chr(c) for c in range(sys.maxunicode) if unicodedata.category(chr(c)) in {'Cc'})
_clean_str_regex = re.compile('(\033\[[0-9]*m|[%s])' % re.escape(_all_control_chars)) _clean_str_regex = re.compile(r'(\033\[[0-9]*m|[%s])' % re.escape(_all_control_chars))
EMERG = int(syslog.LOG_EMERG) EMERG = int(syslog.LOG_EMERG)
ALERT = int(syslog.LOG_ALERT) ALERT = int(syslog.LOG_ALERT)
@ -72,7 +72,7 @@ _log_prefix = ''
_clean_log_prefix = '' _clean_log_prefix = ''
_file_name_len = 20 _file_name_len = 20
_module_name_len = 50 _module_name_len = 50
_log_file_streams = [] _log_file_streams: list[io.TextIOWrapper] = []
_short_prio_str = { _short_prio_str = {
EMERG : '<Y>', EMERG : '<Y>',