This commit is contained in:
Lukas Pupka-Lipinski 2025-10-05 22:29:22 +02:00
parent 85f2d2c6f7
commit 969533f1de
4 changed files with 16 additions and 10 deletions

View File

@ -66,7 +66,7 @@ class EnvironmentConfig:
# Logging # Logging
LOG_LEVEL: str = os.getenv('LOG_LEVEL', 'INFO') LOG_LEVEL: str = os.getenv('LOG_LEVEL', 'INFO')
LOG_FILE: str = os.getenv('LOG_FILE', 'logs/aniworld.log') LOG_FILE: str = os.getenv('LOG_FILE', './logs/aniworld.log')
@classmethod @classmethod
def get_database_config(cls) -> Dict[str, Any]: def get_database_config(cls) -> Dict[str, Any]:
@ -196,7 +196,7 @@ MAX_CONCURRENT_DOWNLOADS=3
# Logging # Logging
LOG_LEVEL=INFO LOG_LEVEL=INFO
LOG_FILE=logs/aniworld.log LOG_FILE=./logs/aniworld.log
""" """
with open(file_path, 'w', encoding='utf-8') as f: with open(file_path, 'w', encoding='utf-8') as f:

View File

@ -31,7 +31,7 @@ class Config:
"enable_console_logging": True, "enable_console_logging": True,
"enable_console_progress": False, "enable_console_progress": False,
"enable_fail2ban_logging": True, "enable_fail2ban_logging": True,
"log_file": "aniworld.log", "log_file": "./logs/aniworld.log",
"max_log_size_mb": 10, "max_log_size_mb": 10,
"log_backup_count": 5 "log_backup_count": 5
}, },

View File

@ -36,7 +36,7 @@ logging.basicConfig(
level=logging.INFO, level=logging.INFO,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
handlers=[ handlers=[
logging.FileHandler('logs/aniworld.log'), logging.FileHandler('./logs/aniworld.log'),
logging.StreamHandler() logging.StreamHandler()
] ]
) )
@ -57,7 +57,7 @@ class Settings(BaseSettings):
log_level: str = Field(default="INFO", env="LOG_LEVEL") log_level: str = Field(default="INFO", env="LOG_LEVEL")
# Additional settings from .env # Additional settings from .env
database_url: str = Field(default="sqlite:///./aniworld.db", env="DATABASE_URL") database_url: str = Field(default="sqlite:///./data/aniworld.db", env="DATABASE_URL")
cors_origins: str = Field(default="*", env="CORS_ORIGINS") cors_origins: str = Field(default="*", env="CORS_ORIGINS")
api_rate_limit: int = Field(default=100, env="API_RATE_LIMIT") api_rate_limit: int = Field(default=100, env="API_RATE_LIMIT")
default_provider: str = Field(default="aniworld.to", env="DEFAULT_PROVIDER") default_provider: str = Field(default="aniworld.to", env="DEFAULT_PROVIDER")

View File

@ -26,7 +26,11 @@ def get_logging_config():
'enable_console_logging': config.enable_console_logging, 'enable_console_logging': config.enable_console_logging,
'enable_console_progress': config.enable_console_progress, 'enable_console_progress': config.enable_console_progress,
'enable_fail2ban_logging': config.enable_fail2ban_logging, 'enable_fail2ban_logging': config.enable_fail2ban_logging,
'log_files': log_config.get_log_files() if hasattr(log_config, 'get_log_files') else [] 'log_files': [
'./logs/aniworld.log',
'./logs/auth_failures.log',
'./logs/downloads.log'
]
} }
return jsonify({ return jsonify({
@ -102,10 +106,12 @@ def list_log_files():
"""Get list of available log files.""" """Get list of available log files."""
try: try:
from src.infrastructure.logging.GlobalLogger import error_logger from src.infrastructure.logging.GlobalLogger import error_logger
# Return basic log files
# Since we don't have log_config.get_log_files(), return basic log files log_files = [
log_files = ["aniworld.log", "auth_failures.log", "downloads.log"] './logs/aniworld.log',
'./logs/auth_failures.log',
'./logs/downloads.log'
]
return jsonify({ return jsonify({
'success': True, 'success': True,
'files': log_files 'files': log_files