Bump log version; use project root for module name

Bump logging version to 1.4.1 and improve module name detection by adding _find_project_root in log_funcs to locate the repository root (searches for a .git directory) and use its basename when LOG_MODULE_NAME is not set, with a fallback to the previous behavior. Also update the same version string in logger.py. Additionally, comment out two noisy debug log lines in core/scanner.py to reduce verbose output when directories are missing or after scanning.
This commit is contained in:
Dariusz L
2026-04-22 03:44:41 +02:00
parent 5fa6b2a731
commit 3687d26f17
3 changed files with 16 additions and 5 deletions
+13 -2
View File
@@ -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])
+1 -1
View File
@@ -1,7 +1,7 @@
"""
@author: Azornes
@title: AzLogs
@version: 1.4.0
@version: 1.4.1
@description: Logging Setup - Central logging system
Features:
+2 -2
View File
@@ -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}")