init repo
This commit is contained in:
commit
250512527e
10
.gitignore
vendored
Normal file
10
.gitignore
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
# 编译时文件夹忽略
|
||||
build/
|
||||
dist/
|
||||
# 运行时缓存文件夹忽略
|
||||
onekeydiag_cache/
|
||||
|
||||
# 可能存在的压缩包文件忽略
|
||||
*.gz
|
||||
*.tar
|
||||
*.zip
|
||||
0
distruibution.spec
Normal file
0
distruibution.spec
Normal file
1
docs/D01_环境部署.md
Normal file
1
docs/D01_环境部署.md
Normal file
@ -0,0 +1 @@
|
||||
# D01_环境部署
|
||||
1
docs/D02_工程结构.md
Normal file
1
docs/D02_工程结构.md
Normal file
@ -0,0 +1 @@
|
||||
# D02_工程结构
|
||||
7
readme.md
Normal file
7
readme.md
Normal file
@ -0,0 +1,7 @@
|
||||
# OneKeyLog Diag Program V2
|
||||
|
||||
## 简介
|
||||
|
||||
## 开发指北
|
||||
|
||||
## 使用指南
|
||||
BIN
resource/favicon.ico
Normal file
BIN
resource/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
11
src/app/main.py
Normal file
11
src/app/main.py
Normal file
@ -0,0 +1,11 @@
|
||||
import os, sys
|
||||
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
|
||||
from common.app_logger import record_log
|
||||
from common.cache_mgmt import app_cache_create
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Project Entry
|
||||
app_cache_create()
|
||||
record_log("INFO", "Start App")
|
||||
|
||||
2
src/backend/.gitignore
vendored
Normal file
2
src/backend/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
# 外网开源, 项目级敏感代码忽略
|
||||
proj_ZiJin/
|
||||
0
src/backend/__init__.py
Normal file
0
src/backend/__init__.py
Normal file
0
src/backend/back_service.py
Normal file
0
src/backend/back_service.py
Normal file
0
src/backend/proj_app/__init__.py
Normal file
0
src/backend/proj_app/__init__.py
Normal file
1
src/common/.gitignore
vendored
Normal file
1
src/common/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
__pycache__/
|
||||
8
src/common/__init__.py
Normal file
8
src/common/__init__.py
Normal file
@ -0,0 +1,8 @@
|
||||
from ._globals import (
|
||||
cache_dir
|
||||
)
|
||||
|
||||
def init_package_coomon():
|
||||
pass
|
||||
|
||||
init_package_coomon()
|
||||
9
src/common/_globals.py
Normal file
9
src/common/_globals.py
Normal file
@ -0,0 +1,9 @@
|
||||
""" common 包中的全局变量
|
||||
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
source_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
proj_dir = os.path.dirname(source_dir)
|
||||
cache_dir = os.path.join(proj_dir, "onekeydiag_cache")
|
||||
32
src/common/app_logger.py
Normal file
32
src/common/app_logger.py
Normal file
@ -0,0 +1,32 @@
|
||||
import os
|
||||
import time
|
||||
|
||||
from . import cache_dir
|
||||
|
||||
LOG_FILE = os.path.join(cache_dir, "running.log")
|
||||
|
||||
def record_log(log_level, log_description):
|
||||
"""
|
||||
记录日志到指定路径的函数
|
||||
|
||||
参数:
|
||||
log_level (str): 日志等级,如"INFO", "WARNING", "ERROR", "CRITICAL"等
|
||||
log_description (str): 日志的具体描述内容
|
||||
"""
|
||||
try:
|
||||
|
||||
# 日志时间格式:YYYY-MM-DD HH:MM:SS
|
||||
current_time = time.strftime("%Y-%m-%d %H:%M:%S")
|
||||
|
||||
# 构建日志内容
|
||||
log_entry = f"[{current_time}] [{log_level.upper()}] {log_description}\n"
|
||||
|
||||
# 追加写入日志
|
||||
with open(LOG_FILE, "a", encoding="utf-8") as f:
|
||||
f.write(log_entry)
|
||||
|
||||
return True
|
||||
|
||||
except Exception as e:
|
||||
print(f"日志记录失败: {str(e)}")
|
||||
return False
|
||||
12
src/common/cache_mgmt.py
Normal file
12
src/common/cache_mgmt.py
Normal file
@ -0,0 +1,12 @@
|
||||
import os
|
||||
|
||||
from . import cache_dir
|
||||
from app_logger import LOG_FILE
|
||||
|
||||
def app_cache_create():
|
||||
if not os.path.exists(cache_dir):
|
||||
os.makedirs(cache_dir)
|
||||
|
||||
def clean_running_log():
|
||||
if os.path.exists(LOG_FILE):
|
||||
os.remove(LOG_FILE)
|
||||
0
src/common/file_tool.py
Normal file
0
src/common/file_tool.py
Normal file
0
src/frontend/__init__.py
Normal file
0
src/frontend/__init__.py
Normal file
0
src/frontend/onekeydiag_ui.py
Normal file
0
src/frontend/onekeydiag_ui.py
Normal file
0
version
Normal file
0
version
Normal file
Loading…
Reference in New Issue
Block a user