Open log file with UTF-8 encoding
Specify encoding='utf-8' when opening the log file in append mode to ensure non-ASCII characters are written correctly and to avoid Unicode-related errors when writing log entries.
This commit is contained in:
parent
f047f26df0
commit
7988285330
|
|
@ -948,7 +948,7 @@ def run_analysis():
|
|||
func(*args, **kwargs)
|
||||
timestamp, message_type, content = obj.messages[-1]
|
||||
content = content.replace("\n", " ") # Replace newlines with spaces
|
||||
with open(log_file, "a") as f:
|
||||
with open(log_file, "a", encoding="utf-8") as f:
|
||||
f.write(f"{timestamp} [{message_type}] {content}\n")
|
||||
return wrapper
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue