Skip to content

Commit 83efdfc

Browse files
committed
♻️ refactor(fullauto): 改进错误日志记录
1 parent bd3b376 commit 83efdfc

5 files changed

Lines changed: 9 additions & 9 deletions

File tree

src/tasks/fullauto/Auto65ArtifactTask_Fast.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ def walk_to_aim(self):
227227
except TaskDisabledException:
228228
raise
229229
except Exception as e:
230-
logger.error(f"移动过程出错: {e}")
230+
logger.error("移动过程出错", e)
231231
raise
232232
finally:
233233
# 确保释放所有按键

src/tasks/fullauto/Auto70jjbTask.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ def walk_to_aim(self):
342342
self._path_elevator_center()
343343

344344
except Exception as e:
345-
print(f"Error in walk_to_aim: {e}")
345+
logger.error("Error in walk_to_aim", e)
346346
# 可以在这里添加日志记录
347347
finally:
348348
self._release_all_move_keys()

src/tasks/fullauto/AutoEscortTask.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ def _load_escort_paths(self):
8181
logger.error(f"✗ 护送路径文件不存在: {json_path}")
8282
return {}
8383
except json.JSONDecodeError as e:
84-
logger.error(f"✗ 护送路径 JSON 解析失败: {e}")
84+
logger.error("✗ 护送路径 JSON 解析失败", e)
8585
return {}
8686
except Exception as e:
87-
logger.error(f"✗ 加载护送路径失败: {e}")
87+
logger.error("✗ 加载护送路径失败", e)
8888
return {}
8989

9090
def run(self):
@@ -369,7 +369,7 @@ def select_escort_path_by_position(self):
369369
)
370370

371371
except Exception as e:
372-
logger.error(f"❌ 检测 track_point 时出错: {e},重新开始任务...")
372+
logger.error("❌ 检测 track_point 时出错,重新开始任务...", e)
373373
self.give_up_mission()
374374
return None
375375

src/tasks/fullauto/AutoFishTask.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ def find_bar_and_fish_by_area(self):
232232
# cv2.destroyAllWindows()
233233
raise
234234
except Exception as e:
235-
logger.error(f"find_bar_and_fish_by_area error: {e}")
235+
logger.error("find_bar_and_fish_by_area error", e)
236236
return (False, None, None), (False, None, None)
237237

238238
# ---- phases ----
@@ -565,5 +565,5 @@ def do_run(self):
565565
except TaskDisabledException:
566566
raise
567567
except Exception as e:
568-
logger.error(f"AutoFishTask fatal: {e}")
568+
logger.error("AutoFishTask fatal", e)
569569
break

src/tasks/trigger/AutoMazeTask.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,10 @@ def _load_puzzle_paths(self):
136136
logger.error(f"✗ 解密路径文件不存在: {json_path}")
137137
return {}
138138
except json.JSONDecodeError as e:
139-
logger.error(f"✗ 解密路径 JSON 解析失败: {e}")
139+
logger.error("✗ 解密路径 JSON 解析失败", e)
140140
return {}
141141
except Exception as e:
142-
logger.error(f"✗ 加载解密路径失败: {e}")
142+
logger.error("✗ 加载解密路径失败", e)
143143
return {}
144144

145145

0 commit comments

Comments
 (0)