Refactor into modular app structure
Split monolithic files into focused modules: - app/core: settings, logging, lifecycle - app/signaling: websocket server, ICE parser, message models - app/webrtc: peer session, video receiver, frame source - app/vision: pose landmarker wrapper, model config, pose types - app/exercises/dead_bug: detector, metrics, rules, state machine, types - app/rendering: skeleton renderer, status overlay, window display - app/audio: rep announcer - app/diagnostics: perf timer, crash handler - configs: environment-based settings - tests: unit tests for rules, state machine, ICE parser - run.py: entry point
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from app.diagnostics.crash_handler import enable_crash_handler
|
||||
from configs.default import LOG_DIR
|
||||
|
||||
|
||||
def startup() -> None:
|
||||
enable_crash_handler(LOG_DIR)
|
||||
from app.core.logging import setup_logging
|
||||
setup_logging()
|
||||
@@ -0,0 +1,20 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from loguru import logger
|
||||
|
||||
from configs.default import LOG_DIR, LOG_RETENTION, LOG_ROTATION
|
||||
|
||||
|
||||
def setup_logging() -> None:
|
||||
LOG_DIR.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
logger.add(
|
||||
LOG_DIR / "posefit-server_{time:YYYY-MM-DD}.log",
|
||||
rotation=LOG_ROTATION,
|
||||
retention=LOG_RETENTION,
|
||||
enqueue=True,
|
||||
backtrace=True,
|
||||
diagnose=True,
|
||||
)
|
||||
Reference in New Issue
Block a user