diff --git a/core/log_system/log_funcs.py b/core/log_system/log_funcs.py index 508f513..fbfdff1 100644 --- a/core/log_system/log_funcs.py +++ b/core/log_system/log_funcs.py @@ -1,7 +1,7 @@ """ @author: Azornes @title: AzLogs -@version: 1.4.0 +@version: 1.4.1 @description: Logging Initializator """ @@ -15,10 +15,21 @@ try: from .logger import logger, LogLevel, debug, info, warn, error, exception from .config import LOG_LEVEL, LOG_MODULE_NAME + def _find_project_root(start_path): + current = os.path.dirname(os.path.abspath(start_path)) + while current: + if os.path.isdir(os.path.join(current, ".git")): + return current + parent = os.path.dirname(current) + if parent == current: + break + current = parent + return os.path.dirname(os.path.dirname(os.path.abspath(start_path))) + _module_name = ( LOG_MODULE_NAME if LOG_MODULE_NAME is not None - else os.path.basename(os.path.dirname(os.path.abspath(__file__))) + else os.path.basename(_find_project_root(__file__)) ) logger.set_module_level(_module_name, LogLevel[LOG_LEVEL]) diff --git a/core/log_system/logger.py b/core/log_system/logger.py index c154cf5..a6da0b1 100644 --- a/core/log_system/logger.py +++ b/core/log_system/logger.py @@ -1,7 +1,7 @@ """ @author: Azornes @title: AzLogs -@version: 1.4.0 +@version: 1.4.1 @description: Logging Setup - Central logging system Features: diff --git a/core/scanner.py b/core/scanner.py index a4b22eb..ab52e43 100644 --- a/core/scanner.py +++ b/core/scanner.py @@ -86,7 +86,7 @@ def scan_directory( models = [] if not os.path.exists(directory) or not os.path.isdir(directory): - log_debug(f"Directory does not exist or is not accessible: {directory}") + # log_debug(f"Directory does not exist or is not accessible: {directory}") return models try: @@ -192,7 +192,7 @@ def scan_all_directories() -> List[Dict[str, str]]: try: models = scan_directory(directory_path, extensions, category) all_models.extend(models) - log_debug(f"Found {len(models)} models in {category}/{directory_path}") + #log_debug(f"Found {len(models)} models in {category}/{directory_path}") except Exception as e: log_warn(f"Error scanning {category} directory {directory_path}: {e}")