improved logging

This commit is contained in:
Ayzen
2026-06-06 00:52:52 +03:00
parent af6005d68f
commit aea49f6128
65 changed files with 1206 additions and 240 deletions
+8 -1
View File
@@ -5,11 +5,14 @@ from __future__ import annotations
from copy import deepcopy
from dataclasses import dataclass, field
import json
import logging
from pathlib import Path
from typing import Any
from python_app.models.run_config_model import RunConfigModel
logger = logging.getLogger(__name__)
@dataclass(slots=True)
class GuiSwitchStateModel:
@@ -159,7 +162,11 @@ class GuiProfileModel:
@classmethod
def load_from_path(cls, path: Path) -> GuiProfileModel:
"""Load JSON file from disk and decode into profile model."""
"""Load a JSON file from disk and decode it into a profile model.
Raises ValueError when the file's JSON root is not an object.
"""
logger.debug("Loading GUI profile from %s", path)
payload = json.loads(path.read_text(encoding="utf-8"))
if not isinstance(payload, dict):
raise ValueError(f"Config profile root must be JSON object: {path}")