mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-09 18:39:04 +08:00
Add: Replace user filepath with "C:\fakepath" in error logs
This commit is contained in:
parent
8a3d8a8ada
commit
4ca076dd05
3
alas.py
3
alas.py
@ -6,7 +6,7 @@ from datetime import datetime
|
||||
from module.config.config import AzurLaneConfig
|
||||
from module.device.device import Device
|
||||
from module.logger import logger, pyw_name, log_file
|
||||
from module.handler.sensitive_info import handle_sensitive_image
|
||||
from module.handler.sensitive_info import handle_sensitive_image, handle_sensitive_logs
|
||||
|
||||
|
||||
class AzurLaneAutoScript:
|
||||
@ -40,6 +40,7 @@ class AzurLaneAutoScript:
|
||||
start = index
|
||||
with open(log_file, 'r') as f:
|
||||
text = f.readlines()[start - 2:]
|
||||
text = handle_sensitive_logs(text)
|
||||
with open(f'{folder}/log.txt', 'w') as f:
|
||||
f.writelines(text)
|
||||
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
import re
|
||||
|
||||
from PIL import Image
|
||||
|
||||
from module.ui.page import *
|
||||
@ -32,3 +34,19 @@ def handle_sensitive_image(image):
|
||||
return put_image_mask(image, mask='MASK_MAIN')
|
||||
|
||||
return image
|
||||
|
||||
|
||||
def handle_sensitive_text(text):
|
||||
"""
|
||||
Args:
|
||||
text (str):
|
||||
|
||||
Returns:
|
||||
str:
|
||||
"""
|
||||
text = re.sub('File \"(.*?)AzurLaneAutoScript', 'File \"C:\\\\fakepath\\\\AzurLaneAutoScript', text)
|
||||
return text
|
||||
|
||||
|
||||
def handle_sensitive_logs(logs):
|
||||
return [handle_sensitive_text(line) for line in logs]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user