From edf128b9f44151d1b8c92e2370bb334278923aa2 Mon Sep 17 00:00:00 2001 From: zw <12345678> Date: Thu, 4 Sep 2025 21:08:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=89=93=E5=8C=85=E5=91=BD?= =?UTF-8?q?=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/workspace.xml | 24 ++++--------- Utils/LogManager.py | 86 +-------------------------------------------- build-tidevice.bat | 4 +-- 3 files changed, 10 insertions(+), 104 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index a3a88ba..295b967 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -5,18 +5,8 @@ - - - - - - - - - - - - - - - + + - - + + + + + \ No newline at end of file diff --git a/Utils/LogManager.py b/Utils/LogManager.py index 2cb0178..8746ec4 100644 --- a/Utils/LogManager.py +++ b/Utils/LogManager.py @@ -1,85 +1,4 @@ -# import logging -# import os -# import sys -# import shutil -# from pathlib import Path -# -# -# class LogManager: -# # 运行根目录:打包后取 exe 目录;源码运行取项目目录 -# if getattr(sys, "frozen", False): -# projectRoot = os.path.dirname(sys.executable) -# else: -# projectRoot = os.path.dirname(os.path.dirname(__file__)) -# -# logDir = os.path.join(projectRoot, "log") -# _loggers = {} -# -# @classmethod -# def _setupLogger(cls, udid, name, logName, level=logging.INFO): -# """创建或获取 logger,并绑定到文件""" -# deviceLogDir = os.path.join(cls.logDir, udid) -# os.makedirs(deviceLogDir, exist_ok=True) -# logFile = os.path.join(deviceLogDir, logName) -# -# logger_name = f"{udid}_{name}" -# logger = logging.getLogger(logger_name) -# logger.setLevel(level) -# -# # 避免重复添加 handler -# if not any( -# isinstance(h, logging.FileHandler) and h.baseFilename == os.path.abspath(logFile) -# for h in logger.handlers -# ): -# fileHandler = logging.FileHandler(logFile, mode="a", encoding="utf-8") -# formatter = logging.Formatter( -# "%(asctime)s - %(name)s - %(levelname)s - %(message)s", -# datefmt="%Y-%m-%d %H:%M:%S" -# ) -# fileHandler.setFormatter(formatter) -# logger.addHandler(fileHandler) -# -# return logger -# -# @classmethod -# def info(cls, text, udid="system"): -# cls._setupLogger(udid, "infoLogger", "info.log", level=logging.INFO).info(f"[{udid}] {text}") -# -# @classmethod -# def warning(cls, text, udid="system"): -# cls._setupLogger(udid, "warningLogger", "warning.log", level=logging.WARNING).warning(f"[{udid}] {text}") -# -# @classmethod -# def error(cls, text, udid="system"): -# cls._setupLogger(udid, "errorLogger", "error.log", level=logging.ERROR).error(f"[{udid}] {text}") -# -# # 清空日志 -# @classmethod -# def clearLogs(cls): -# """启动时清空 log 目录下所有文件""" -# print("开始清空日志...") -# -# # 关闭所有 handler -# for name, logger in logging.Logger.manager.loggerDict.items(): -# if isinstance(logger, logging.Logger): -# for handler in logger.handlers[:]: -# try: -# handler.close() -# except Exception: -# pass -# logger.removeHandler(handler) -# -# # 仅删除目录里的所有文件和子目录 -# log_path = Path(cls.logDir) -# if log_path.exists(): -# for item in log_path.iterdir(): -# if item.is_file(): -# item.unlink() -# elif item.is_dir(): -# import shutil -# shutil.rmtree(item) -# -# print("日志清空完成") + import datetime import io import logging @@ -89,11 +8,8 @@ import sys import shutil import zipfile from pathlib import Path - import requests -import Entity.Variables - class LogManager: # 运行根目录:打包后取 exe 目录;源码运行取项目目录 diff --git a/build-tidevice.bat b/build-tidevice.bat index cb175bb..52df5ee 100644 --- a/build-tidevice.bat +++ b/build-tidevice.bat @@ -4,6 +4,6 @@ pyinstaller -F -n tidevice ^ --hidden-import=tidevice._usbmux ^ --hidden-import=tidevice._wdaproxy ^ --collect-all tidevice ^ - -c ^ + --noconsole ^ --add-data="C:\Users\milk\AppData\Local\Programs\Python\Python312\Lib\site-packages\tidevice;tidevice" ^ - tidevice_entry.py \ No newline at end of file + tidevice_entry.py