Refactor logging setup and enhance debug information in FastAPI application

This commit is contained in:
2025-02-10 21:03:26 +01:00
parent 66bfa96129
commit b5a0afc60c
7 changed files with 36 additions and 8 deletions

View File

@ -1,11 +1,14 @@
from __future__ import annotations
import datetime
import logging
from pathlib import Path
from urllib.parse import urljoin
from discord_embed import settings
logger: logging.Logger = logging.getLogger("uvicorn.error")
def generate_html_for_videos(
url: str,
@ -54,4 +57,14 @@ def generate_html_for_videos(
with Path.open(file_path, "w", encoding="utf-8") as f:
f.write(video_html)
logger.info("Generated HTML file: %s", html_url)
logger.info("Saved HTML file to disk: %s", file_path)
logger.info("Screenshot URL: %s", screenshot)
logger.info("Video URL: %s", url)
logger.info("Video resolution: %dx%d", width, height)
logger.info("Filename: %s", filename)
logger.info("Domain: %s", domain)
logger.info("HTML URL: %s", html_url)
logger.info("Time now: %s", time_now_str)
return html_url