[wifi] fix big bugs

This commit is contained in:
IrvingGao 2024-06-13 16:00:39 +08:00
parent 3b8ae02e10
commit 9dfd4f7c90
1 changed files with 3 additions and 1 deletions

View File

@ -68,9 +68,9 @@ def edit_line_in_file(file_path, search_string, replacement_string):
if search_string in line: if search_string in line:
file.write(replacement_string + '\n') file.write(replacement_string + '\n')
edit = True edit = True
logging.info(f"{datetime.datetime.now()}: The line has been edited. \noriginal line: {line}, \nnew line: {replacement_string}")
else: else:
file.write(line) file.write(line)
logging.info(f"{datetime.datetime.now()}: The line has been edited.")
return edit return edit
except FileNotFoundError: except FileNotFoundError:
logging.info(f"The file {file_path} does not exist.") logging.info(f"The file {file_path} does not exist.")
@ -104,6 +104,8 @@ def close_app():
# 保存Wi-Fi IP地址 # 保存Wi-Fi IP地址
save_local_ip() save_local_ip()
logging.info(f"{datetime.datetime.now()}: Exit Wi-Fi hotspot...")
# 获取当前Flask应用程序的进程ID # 获取当前Flask应用程序的进程ID
flask_pid = os.getpid() flask_pid = os.getpid()