configurable tracebacks

Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
Vladimir Mandic
2025-01-31 10:02:21 -05:00
parent 3dcb70e8a2
commit 3a6471d984
4 changed files with 42 additions and 27 deletions
+4 -20
View File
@@ -1,33 +1,17 @@
import logging
import warnings
from installer import log as installer_log, setup_logging
from installer import log, console, setup_logging, install_traceback
setup_logging()
log = installer_log
from rich.console import Console # pylint: disable=wrong-import-order
from rich.theme import Theme # pylint: disable=wrong-import-order
from rich.pretty import install as pretty_install # pylint: disable=wrong-import-order
from rich.traceback import install as traceback_install # pylint: disable=wrong-import-order
console = Console(log_time=True, tab_size=4, log_time_format='%H:%M:%S-%f', soft_wrap=True, safe_box=True, theme=Theme({
"traceback.border": "black",
"traceback.border.syntax_error": "black",
"inspect.value.border": "black",
}))
pretty_install(console=console)
traceback_install(console=console, extra_lines=1, width=console.width, word_wrap=False, indent_guides=False, max_frames=16)
install_traceback()
already_displayed = {}
def install(suppress=[]):
warnings.filterwarnings("ignore", category=UserWarning)
pretty_install(console=console)
traceback_install(console=console, extra_lines=1, width=console.width, word_wrap=False, indent_guides=False, suppress=suppress)
install_traceback(suppress=suppress)
logging.basicConfig(level=logging.ERROR, format='%(asctime)s | %(levelname)s | %(pathname)s | %(message)s')
# for handler in logging.getLogger().handlers:
# handler.setLevel(logging.INFO)
def print_error_explanation(message):