mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-25 08:58:14 +08:00
Add: Replace user filepath with "C:\fakepath" in error logs
This commit is contained in:
3
alas.py
3
alas.py
@@ -6,7 +6,7 @@ from datetime import datetime
|
|||||||
from module.config.config import AzurLaneConfig
|
from module.config.config import AzurLaneConfig
|
||||||
from module.device.device import Device
|
from module.device.device import Device
|
||||||
from module.logger import logger, pyw_name, log_file
|
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:
|
class AzurLaneAutoScript:
|
||||||
@@ -40,6 +40,7 @@ class AzurLaneAutoScript:
|
|||||||
start = index
|
start = index
|
||||||
with open(log_file, 'r') as f:
|
with open(log_file, 'r') as f:
|
||||||
text = f.readlines()[start - 2:]
|
text = f.readlines()[start - 2:]
|
||||||
|
text = handle_sensitive_logs(text)
|
||||||
with open(f'{folder}/log.txt', 'w') as f:
|
with open(f'{folder}/log.txt', 'w') as f:
|
||||||
f.writelines(text)
|
f.writelines(text)
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import re
|
||||||
|
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
|
||||||
from module.ui.page import *
|
from module.ui.page import *
|
||||||
@@ -32,3 +34,19 @@ def handle_sensitive_image(image):
|
|||||||
return put_image_mask(image, mask='MASK_MAIN')
|
return put_image_mask(image, mask='MASK_MAIN')
|
||||||
|
|
||||||
return image
|
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]
|
||||||
|
|||||||
Reference in New Issue
Block a user