simplify log level config

This commit is contained in:
rambros 2026-03-08 02:46:10 +05:30
parent 3b3b262d8b
commit dc59b21bee
3 changed files with 10 additions and 14 deletions

View file

@ -3,10 +3,6 @@ import yaml
from pathlib import Path
from pydantic import BaseModel, Field
class MigrationSettings(BaseModel):
batch_size: int = Field(default=100)
log_level: str = Field(default="DEBUG")
class AppConfig(BaseModel):
discord_bot_token: Optional[str] = Field(default=None)
discord_server_id: Optional[str] = Field(default=None)
@ -15,7 +11,7 @@ class AppConfig(BaseModel):
target_bot_token: Optional[str] = Field(default=None)
target_server_id: Optional[str] = Field(default=None)
target_api_url: Optional[str] = Field(default=None)
migration: MigrationSettings = Field(default_factory=MigrationSettings)
log_level: str = Field(default="DEBUG")
# ── backwardcompat shims (readonly) ────────────────────────────────
# The rest of the codebase (fluxer/stoat modules) still reads these.

View file

@ -162,7 +162,7 @@ class BackupPane(Container):
@work(exclusive=True)
async def run_backup_profile(self) -> None:
modal = ProgressScreen(log_level=self.config.migration.log_level)
modal = ProgressScreen(log_level=self.config.log_level)
self.app.push_screen(modal)
await asyncio.sleep(0.1)
modal.phase_progress()
@ -214,7 +214,7 @@ class BackupPane(Container):
@work(exclusive=True)
async def run_backup_messages(self) -> None:
modal_prog = ProgressScreen(log_level=self.config.migration.log_level)
modal_prog = ProgressScreen(log_level=self.config.log_level)
self.app.push_screen(modal_prog)
await asyncio.sleep(0.1)
@ -273,7 +273,7 @@ class BackupPane(Container):
selected_channels = [c for c in eligible_channels if c.id in selected_ids]
# Phase 2: Confirmation
modal_prog = ProgressScreen(log_level=self.config.migration.log_level) # Re-instantiate to avoid Textual re-push UI freeze
modal_prog = ProgressScreen(log_level=self.config.log_level) # Re-instantiate to avoid Textual re-push UI freeze
self.app.push_screen(modal_prog)
await asyncio.sleep(0.1)
@ -398,7 +398,7 @@ class BackupPane(Container):
@work(exclusive=True)
async def run_backup_sync(self) -> None:
modal_prog = ProgressScreen(log_level=self.config.migration.log_level)
modal_prog = ProgressScreen(log_level=self.config.log_level)
self.app.push_screen(modal_prog)
await asyncio.sleep(0.1)
modal_prog.phase_progress()

View file

@ -375,7 +375,7 @@ class ShuttlePane(Container):
@work(exclusive=True)
async def run_batch_clone(self, selections: list[str]) -> None:
modal = ProgressScreen(log_level=self.config.migration.log_level)
modal = ProgressScreen(log_level=self.config.log_level)
self.app.push_screen(modal)
await asyncio.sleep(0.1)
connections_started = False
@ -506,7 +506,7 @@ class ShuttlePane(Container):
@work(exclusive=True)
async def run_batch_sync(self, selections: list[str]) -> None:
modal = ProgressScreen(log_level=self.config.migration.log_level)
modal = ProgressScreen(log_level=self.config.log_level)
self.app.push_screen(modal)
await asyncio.sleep(0.1)
try:
@ -766,7 +766,7 @@ class ShuttlePane(Container):
migrate_mod = fluxer_migrate if self.target_platform == "fluxer" else stoat_migrate
platform_name = self.target_platform.capitalize()
modal = ProgressScreen(log_level=self.config.migration.log_level)
modal = ProgressScreen(log_level=self.config.log_level)
self.app.push_screen(modal)
await asyncio.sleep(0.1)
@ -833,7 +833,7 @@ class ShuttlePane(Container):
has_previous = bool(last_migrated)
# Analyze
modal = ProgressScreen(log_level=self.config.migration.log_level)
modal = ProgressScreen(log_level=self.config.log_level)
self.app.push_screen(modal)
await asyncio.sleep(0.1)
@ -1041,7 +1041,7 @@ class ShuttlePane(Container):
@work(exclusive=True)
async def run_batch_danger(self, selections: list[str]) -> None:
modal = ProgressScreen(log_level=self.config.migration.log_level)
modal = ProgressScreen(log_level=self.config.log_level)
self.app.push_screen(modal)
await asyncio.sleep(0.1)
target_started = False