Compare commits

..

3 Commits

Author SHA1 Message Date
83e34e1799 feat(logging): implement configurable belief state logging
- Add LoggingConfig model and logging field to GlobalSettings
- Implement belief_scope context manager for structured logging
- Add configure_logger for dynamic level and file rotation settings
- Add logging configuration UI to Settings page
- Update ConfigManager to apply logging settings on initialization and updates
2025-12-27 05:39:33 +03:00
d197303b9f 006 plan ready 2025-12-26 19:36:49 +03:00
a43f8fb021 001-migration-ui-redesign (#3)
Reviewed-on: #3
2025-12-26 18:17:58 +03:00
6 changed files with 24 additions and 17 deletions

View File

@@ -32,7 +32,6 @@ Python 3.9+ (Backend), Node.js 18+ (Frontend Build): Follow standard conventions
- 006-configurable-belief-logs: Added Python 3.9+ + FastAPI (Backend), Pydantic (Config), Svelte (Frontend) - 006-configurable-belief-logs: Added Python 3.9+ + FastAPI (Backend), Pydantic (Config), Svelte (Frontend)
- 005-fix-ui-ws-validation: Added Python 3.9+ (Backend), Node.js 18+ (Frontend Build) - 005-fix-ui-ws-validation: Added Python 3.9+ (Backend), Node.js 18+ (Frontend Build)
- 005-fix-ui-ws-validation: Added Python 3.9+, Node.js 18+ + FastAPI, SvelteKit, Tailwind CSS, Pydantic - 005-fix-ui-ws-validation: Added Python 3.9+, Node.js 18+ + FastAPI, SvelteKit, Tailwind CSS, Pydantic
- 005-fix-ui-ws-validation: Added Python 3.9+, Node.js 18+ + FastAPI, SvelteKit, Tailwind CSS, Pydantic
<!-- MANUAL ADDITIONS START --> <!-- MANUAL ADDITIONS START -->

BIN
backend/mappings.db Normal file

Binary file not shown.

View File

@@ -15,6 +15,7 @@ from backend.src.dependencies import get_config_manager
from backend.src.core.superset_client import SupersetClient from backend.src.core.superset_client import SupersetClient
from superset_tool.models import SupersetConfig from superset_tool.models import SupersetConfig
from pydantic import BaseModel from pydantic import BaseModel
from backend.src.core.logger import logger
# [/SECTION] # [/SECTION]
router = APIRouter(prefix="/api/environments", tags=["environments"]) router = APIRouter(prefix="/api/environments", tags=["environments"])
@@ -38,7 +39,9 @@ class DatabaseResponse(BaseModel):
# @RETURN: List[EnvironmentResponse] # @RETURN: List[EnvironmentResponse]
@router.get("", response_model=List[EnvironmentResponse]) @router.get("", response_model=List[EnvironmentResponse])
async def get_environments(config_manager=Depends(get_config_manager)): async def get_environments(config_manager=Depends(get_config_manager)):
logger.info(f"[get_environments][Debug] Config path: {config_manager.config_path}")
envs = config_manager.get_environments() envs = config_manager.get_environments()
logger.info(f"[get_environments][Debug] Found {len(envs)} environments")
return [EnvironmentResponse(id=e.id, name=e.name, url=e.url) for e in envs] return [EnvironmentResponse(id=e.id, name=e.name, url=e.url) for e in envs]
# [/DEF:get_environments] # [/DEF:get_environments]

View File

@@ -16,7 +16,7 @@ from ...core.config_models import AppConfig, Environment, GlobalSettings
from ...dependencies import get_config_manager from ...dependencies import get_config_manager
from ...core.config_manager import ConfigManager from ...core.config_manager import ConfigManager
from ...core.logger import logger from ...core.logger import logger
from ...core.superset_client import SupersetClient from superset_tool.client import SupersetClient
from superset_tool.models import SupersetConfig from superset_tool.models import SupersetConfig
import os import os
# [/SECTION] # [/SECTION]

View File

@@ -103,16 +103,25 @@
<p class="mt-1 text-sm text-gray-500">Regular expression to filter dashboards to migrate.</p> <p class="mt-1 text-sm text-gray-500">Regular expression to filter dashboards to migrate.</p>
</div> </div>
<div class="flex items-center mb-8"> <div class="flex items-center justify-between mb-8">
<input <div class="flex items-center">
id="replace-db" <input
type="checkbox" id="replace-db"
bind:checked={replaceDb} type="checkbox"
class="h-4 w-4 text-indigo-600 focus:ring-indigo-500 border-gray-300 rounded" bind:checked={replaceDb}
/> class="h-4 w-4 text-indigo-600 focus:ring-indigo-500 border-gray-300 rounded"
<label for="replace-db" class="ml-2 block text-sm text-gray-900"> />
Replace Database (Apply Mappings) <label for="replace-db" class="ml-2 block text-sm text-gray-900">
</label> Replace Database (Apply Mappings)
</label>
</div>
<a
href="/migration/mappings"
class="text-sm font-medium text-indigo-600 hover:text-indigo-500"
>
Manage Mappings &rarr;
</a>
</div> </div>
<button <button

View File

@@ -28,11 +28,7 @@ class SupersetLogger:
# @PARAM: log_dir (Optional[Path]) - Директория для сохранения лог-файлов. # @PARAM: log_dir (Optional[Path]) - Директория для сохранения лог-файлов.
# @PARAM: level (int) - Уровень логирования (e.g., `logging.INFO`). # @PARAM: level (int) - Уровень логирования (e.g., `logging.INFO`).
# @PARAM: console (bool) - Флаг для включения вывода в консоль. # @PARAM: console (bool) - Флаг для включения вывода в консоль.
def __init__(self, name: str = "superset_tool", log_dir: Optional[Path] = None, level: int = logging.INFO, console: bool = True, logger: Optional[logging.Logger] = None) -> None: def __init__(self, name: str = "superset_tool", log_dir: Optional[Path] = None, level: int = logging.INFO, console: bool = True) -> None:
if logger:
self.logger = logger
return
self.logger = logging.getLogger(name) self.logger = logging.getLogger(name)
self.logger.setLevel(level) self.logger.setLevel(level)
self.logger.propagate = False self.logger.propagate = False