]> 小龙服务器 Git - 微信监控/commitdiff
控制面板增加'打开日志'按钮
author小龙 <xl@szjxzxh.cn>
Thu, 30 Jul 2026 01:05:38 +0000 (09:05 +0800)
committer小龙 <xl@szjxzxh.cn>
Thu, 30 Jul 2026 01:05:38 +0000 (09:05 +0800)
wechat_auto_login.py

index cd84a85c9834aef48e4aaf07256a1c98433ccaae..1db1ae81c2da48a53d460b22ee2d95861990167d 100644 (file)
@@ -409,6 +409,19 @@ try:
             )
             self.info_btn.place(relx=1.0, x=-4, y=2, anchor="ne")
 
+            # 打开日志按钮
+            self.log_btn = tk.Button(
+                self.root,
+                text="📁 打开日志",
+                font=("Segoe UI", 9),
+                bg="#E0E0E0",
+                fg="#333333",
+                bd=1,
+                cursor="hand2",
+                command=self._open_log,
+            )
+            self.log_btn.place(relx=0.5, rely=0.62, anchor="center")
+
             # 中央开关按钮
             self.toggle_btn = tk.Button(
                 self.root,
@@ -527,6 +540,20 @@ try:
                 self._resend_link_sent = False
                 log.info("监控已停用")
 
+        # ── open log ──
+        def _open_log(self):
+            """打开日志文件所在的目录"""
+            log_dir = os.path.dirname(os.path.abspath(__file__))
+            log_file = os.path.join(log_dir, "wechat_monitor.log")
+            if os.path.exists(log_file):
+                os.startfile(log_file)
+            else:
+                try:
+                    # 尝试打开日志目录
+                    os.startfile(log_dir)
+                except Exception:
+                    pass
+
         # ── status ──
         def _set_status(self, text):
             self.status_var.set(text)