diff --git a/core/acoustid_client.py b/core/acoustid_client.py index d1d9eedc..5eb1b7b6 100644 --- a/core/acoustid_client.py +++ b/core/acoustid_client.py @@ -44,7 +44,7 @@ _acoustid_file_handler.setFormatter(logging.Formatter( datefmt='%Y-%m-%d %H:%M:%S' )) logger.addHandler(_acoustid_file_handler) -logging.getLogger("newmusic.acoustid_verification").addHandler(_acoustid_file_handler) +logging.getLogger("soulsync.acoustid_verification").addHandler(_acoustid_file_handler) # Check if pyacoustid is available try: diff --git a/core/tag_writer.py b/core/tag_writer.py index 9ea89a34..d1d11c21 100644 --- a/core/tag_writer.py +++ b/core/tag_writer.py @@ -16,7 +16,7 @@ from mutagen.mp4 import MP4, MP4Cover, MP4FreeForm from mutagen.oggvorbis import OggVorbis from mutagen.apev2 import APEv2, APENoHeaderError -logger = logging.getLogger("newmusic.tag_writer") +logger = logging.getLogger("soulsync.tag_writer") # Supported extensions SUPPORTED_EXTENSIONS = {'.mp3', '.flac', '.ogg', '.oga', '.opus', '.m4a', '.mp4'} diff --git a/utils/logging_config.py b/utils/logging_config.py index 1a4beae9..f7f36d0e 100644 --- a/utils/logging_config.py +++ b/utils/logging_config.py @@ -6,6 +6,8 @@ from pathlib import Path from datetime import datetime from typing import Optional +LOGGER_NAMESPACE = "soulsync" + class SafeFormatter(logging.Formatter): """Formatter that handles Unicode characters safely on Windows""" @@ -52,7 +54,7 @@ class ColoredFormatter(SafeFormatter): def setup_logging(level: str = "INFO", log_file: Optional[str] = None) -> logging.Logger: log_level = getattr(logging, level.upper(), logging.INFO) - logger = logging.getLogger("newmusic") + logger = logging.getLogger(LOGGER_NAMESPACE) logger.setLevel(log_level) if logger.handlers: @@ -91,15 +93,15 @@ def setup_logging(level: str = "INFO", log_file: Optional[str] = None) -> loggin return logger def get_logger(name: str) -> logging.Logger: - return logging.getLogger(f"newmusic.{name}") + return logging.getLogger(f"{LOGGER_NAMESPACE}.{name}") def set_log_level(level: str) -> bool: """Dynamically change the log level for all loggers without restart""" try: log_level = getattr(logging, level.upper(), logging.INFO) - # Get the root "newmusic" logger - root_logger = logging.getLogger("newmusic") + # Get the root "soulsync" logger + root_logger = logging.getLogger(LOGGER_NAMESPACE) root_logger.setLevel(log_level) # Update all handlers @@ -109,12 +111,12 @@ def set_log_level(level: str) -> bool: root_logger.info(f"Log level changed to: {level.upper()}") return True except Exception as e: - logging.getLogger("newmusic").error(f"Error setting log level: {e}") + logging.getLogger(LOGGER_NAMESPACE).error(f"Error setting log level: {e}") return False def get_current_log_level() -> str: """Get the current log level""" - root_logger = logging.getLogger("newmusic") + root_logger = logging.getLogger(LOGGER_NAMESPACE) return logging.getLevelName(root_logger.level) main_logger = get_logger("main")