Went into wrong branch, whoops

This went into the current branch as it was approved I just going to directly add into Alpha 2.
This commit is contained in:
Yusarina
2025-02-07 18:31:04 +00:00
committed by GitHub
parent a20a306582
commit bf6a32febb
+11
View File
@@ -1,8 +1,10 @@
import logging import logging
import traceback
from typing import Optional, Any from typing import Optional, Any
from bpy.types import Context from bpy.types import Context
logger = logging.getLogger('avatar_toolkit') logger = logging.getLogger('avatar_toolkit')
_original_error = logger.error
def configure_logging(enabled: bool = False) -> None: def configure_logging(enabled: bool = False) -> None:
"""Configure logging for Avatar Toolkit""" """Configure logging for Avatar Toolkit"""
@@ -18,6 +20,15 @@ def configure_logging(enabled: bool = False) -> None:
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
handler.setFormatter(formatter) handler.setFormatter(formatter)
logger.addHandler(handler) logger.addHandler(handler)
def error_with_traceback(msg, *args, **kwargs):
if kwargs.get('exc_info', False) or isinstance(msg, Exception):
full_msg = f"{msg}\n{traceback.format_exc()}"
_original_error(full_msg, *args, **{**kwargs, 'exc_info': False})
else:
_original_error(msg, *args, **kwargs)
logger.error = error_with_traceback
def update_logging_state(self: Any, context: Context) -> None: def update_logging_state(self: Any, context: Context) -> None:
"""Update logging state based on user preference""" """Update logging state based on user preference"""