refactor: replace logging with structlog

This commit is contained in:
2025-10-28 21:18:27 +08:00
parent 9a761f1191
commit 9c96714c8f
2 changed files with 6 additions and 9 deletions

10
app.py
View File

@ -1,7 +1,7 @@
import logging
import sys
from pathlib import Path
import structlog
from PySide6.QtCore import QCoreApplication, QObject, Qt, QUrl
from PySide6.QtGui import QGuiApplication, QIcon
from PySide6.QtQml import QQmlApplicationEngine
@ -14,12 +14,8 @@ from ui.viewmodels import overview # noqa: F401
CURRENT_DIRECTORY = Path(__file__).resolve().parent
DEFAULT_FONTS = ["微软雅黑", "Microsoft YaHei UI", "Microsoft YaHei", "Segoe UI"]
logger = logging.getLogger(__name__)
logging.basicConfig(
level=logging.INFO,
format="[%(asctime)s][%(levelname)s] %(message)s",
datefmt="%H:%M:%S",
)
logger: structlog.stdlib.BoundLogger = structlog.get_logger()
def main() -> None:

View File

@ -1,8 +1,8 @@
import dataclasses
import logging
from enum import StrEnum
from pathlib import Path
import structlog
from arcaea_offline.models import (
CalculatedPotential,
Chart,
@ -29,7 +29,8 @@ from core.settings.values import GeneralDatabaseType
from .common import VM_QML_IMPORT_NAME
logger = logging.getLogger(__name__)
logger: structlog.stdlib.BoundLogger = structlog.get_logger()
QML_IMPORT_NAME = VM_QML_IMPORT_NAME
QML_IMPORT_MAJOR_VERSION = 1