Merge pull request #2302 from BEDOLAGA-DEV/dev5

clear logs
This commit is contained in:
Egor
2026-01-17 01:51:04 +03:00
committed by GitHub
4 changed files with 9 additions and 8 deletions

View File

@@ -51,8 +51,8 @@ router = APIRouter(prefix="/admin/ban-system", tags=["Cabinet Admin Ban System"]
def _get_ban_api() -> BanSystemAPI:
"""Get Ban System API instance."""
logger.info(f"Ban System check - enabled: {settings.is_ban_system_enabled()}, configured: {settings.is_ban_system_configured()}")
logger.info(f"Ban System URL: {settings.get_ban_system_api_url()}")
logger.debug(f"Ban System check - enabled: {settings.is_ban_system_enabled()}, configured: {settings.is_ban_system_configured()}")
logger.debug(f"Ban System URL: {settings.get_ban_system_api_url()}")
if not settings.is_ban_system_enabled():
raise HTTPException(
@@ -128,7 +128,7 @@ async def get_stats(
api = _get_ban_api()
data = await _api_request(api, "get_stats")
logger.info(f"Ban System raw stats: {data}")
logger.debug(f"Ban System raw stats: {data}")
# Extract punishment stats
punishment_stats = data.get("punishment_stats") or {}

View File

@@ -1805,17 +1805,17 @@ async def _load_app_config_async() -> Dict[str, Any]:
async with service.get_api_client() as api:
config = await api.get_subscription_page_config(remnawave_uuid)
if config and config.config:
logger.info(f"Loaded app config from RemnaWave: {remnawave_uuid}")
logger.debug(f"Loaded app config from RemnaWave: {remnawave_uuid}")
# Debug: log raw RemnaWave config structure
import json
logger.info(f"RemnaWave raw config: {json.dumps(config.config, ensure_ascii=False, indent=2)[:2000]}")
logger.debug(f"RemnaWave raw config: {json.dumps(config.config, ensure_ascii=False, indent=2)[:2000]}")
converted = _convert_remnawave_config_to_cabinet(config.config)
logger.info(f"Converted config platforms: {list(converted.get('platforms', {}).keys())}")
logger.debug(f"Converted config platforms: {list(converted.get('platforms', {}).keys())}")
# Log first app from each platform
for platform, apps in converted.get('platforms', {}).items():
if apps:
first_app = apps[0]
logger.info(f"Platform {platform} first app: name={first_app.get('name')}, urlScheme={first_app.get('urlScheme')}")
logger.debug(f"Platform {platform} first app: name={first_app.get('name')}, urlScheme={first_app.get('urlScheme')}")
return converted
except Exception as e:
logger.warning(f"Failed to load RemnaWave config, falling back to file: {e}")

View File

@@ -22,7 +22,7 @@ class RequestLoggingMiddleware(BaseHTTPMiddleware):
finally:
duration_ms = (monotonic() - start) * 1000
status = response.status_code if response else "error"
logger.info(
logger.debug(
"%s %s -> %s (%.2f ms)",
request.method,
request.url.path,

View File

@@ -32,6 +32,7 @@ class WebAPIServer:
log_level=settings.LOG_LEVEL.lower(),
workers=workers,
lifespan="on",
access_log=False,
)
self._server = uvicorn.Server(self._config)
self._task: Optional[asyncio.Task[None]] = None