refactor(logging): reduce download log spam and set INFO level

- Pass app logger to yt-dlp so internal [download] progress lines
  are routed through the INFO-level logger instead of stdout.
- Throttle download_progress_handler debug logging to avoid
  flooding logs on every fragment tick.
- Switch key provider lifecycle messages to INFO (start/complete)
  while keeping verbose details at DEBUG.
- Set debug_enabled=False in development config so dev mode
  does not emit extra debug noise.
- Update config docstring example from DEBUG to INFO.
This commit is contained in:
2026-05-18 09:56:19 +02:00
parent a08a8f7408
commit 363f7899f8
5 changed files with 11 additions and 6 deletions

View File

@@ -445,9 +445,12 @@ class SeriesApp:
try:
def download_progress_handler(progress_info):
"""Handle download progress events from loader."""
logger.debug(
"download_progress_handler called with: %s", progress_info
)
# Throttle progress logging to avoid spam
status = progress_info.get("status", "")
if status in ("downloading", "finished"):
logger.debug(
"download_progress_handler called with: %s", progress_info
)
downloaded = progress_info.get('downloaded_bytes', 0)
total_bytes = (

View File

@@ -331,6 +331,7 @@ class AniworldLoader(Loader):
'no_warnings': True,
'progress_with_newline': False,
'nocheckcertificate': True,
'logger': logger,
'progress_hooks': [events_progress_hook],
}
@@ -339,7 +340,7 @@ class AniworldLoader(Loader):
logger.debug("Using custom headers for download")
try:
logger.debug("Starting YoutubeDL download")
logger.info("Starting download: %s", output_file)
logger.debug("Download link: %s...", link[:100])
logger.debug("YDL options: %s", ydl_opts)

View File

@@ -566,6 +566,7 @@ class EnhancedAniWorldLoader(Loader):
"nocheckcertificate": True,
"socket_timeout": self.download_timeout,
"http_chunk_size": 1024 * 1024, # 1MB chunks
"logger": self.logger,
}
if headers:
ydl_opts['http_headers'] = headers

View File

@@ -39,7 +39,7 @@ def get_settings() -> Union[DevelopmentSettings, ProductionSettings]:
Example:
>>> settings = get_settings()
>>> print(settings.log_level)
DEBUG
INFO
"""
if ENVIRONMENT in {"development", "testing"}:
return get_development_settings()

View File

@@ -215,7 +215,7 @@ class DevelopmentSettings(BaseSettings):
@property
def debug_enabled(self) -> bool:
"""Check if debug mode is enabled."""
return True
return False
@property
def reload_enabled(self) -> bool: