refactor: enhance logging setup in logger.py and improve debug output in rahasher.py

This commit is contained in:
zurdi
2025-05-10 22:34:51 +00:00
parent 6da852ae58
commit 9d7fdf10dd
2 changed files with 7 additions and 3 deletions

View File

@@ -1,6 +1,9 @@
import asyncio
import re
from handler.metadata.ra_handler import RA_ID_TO_SLUG
from logger.formatter import LIGHTMAGENTA
from logger.formatter import highlight as hl
from logger.logger import log
RAHASHER_VALID_HASH_REGEX = re.compile(r"^[0-9a-f]{32}$")
@@ -87,9 +90,10 @@ class RAHasherService:
"""Service to calculate RetroAchievements hashes using RAHasher."""
async def calculate_hash(self, platform_id: int, file_path: str) -> str:
log.debug(
f"Executing {hl('RAHasher', color=LIGHTMAGENTA)} for platform: {hl(RA_ID_TO_SLUG[platform_id])} - file: {hl(file_path.split('/')[-1])}"
)
args = (str(platform_id), file_path)
log.debug("Executing RAHasher with args: %s", args)
proc = await asyncio.create_subprocess_exec(
"RAHasher",
*args,

View File

@@ -5,7 +5,7 @@ from config import LOGLEVEL
from logger.formatter import Formatter
# Set up logger
log = logging.getLogger()
log = logging.getLogger("romm")
log.setLevel(LOGLEVEL)
# Define stdout handler