Files
vpn-control-panel/app/config.py
smolkik-code 7c7c88621d Initial commit: VPN Control Panel
- FastAPI REST API with JWT auth
- aiogram 3 Telegram bot with admin middleware
- APScheduler daily tasks (expiry, reminders, revoke, sync)
- SQLAlchemy 2 async ORM with Alembic migrations
- Jinja2 admin panel (Dashboard, Users, Payments, Servers, Tariffs)
- VPN provider abstraction with MockProvider
- Stats service with revenue/subscription analytics
- Docker Compose (PostgreSQL + Redis + app)
- Healthcheck endpoint
2026-07-05 17:50:11 +07:00

35 lines
835 B
Python

import sys
from loguru import logger
from app.settings import settings
def setup_logging() -> None:
logger.remove()
level = "DEBUG" if settings.debug else "INFO"
logger.add(
sys.stdout,
level=level,
colorize=True,
format=(
"<green>{time:YYYY-MM-DD HH:mm:ss}</green> | "
"<level>{level: <8}</level> | "
"<cyan>{name}</cyan>:<cyan>{function}</cyan>:<cyan>{line}</cyan> | "
"<level>{message}</level>"
),
)
logger.add(
"logs/app_{time:YYYY-MM-DD}.log",
level=level,
rotation="1 day",
retention="30 days",
compression="gz",
format="{time:YYYY-MM-DD HH:mm:ss} | {level: <8} | {name}:{function}:{line} | {message}",
)
logger.info("Logging configured | level={}", level)