Add exception stack caller and add this to the logger exception call

So we get the location of the exception in the console log too
This commit is contained in:
Clemens Schwaighofer
2025-07-28 15:26:23 +09:00
parent 5203bcf1ea
commit 4f9c2b9d5f
4 changed files with 39 additions and 3 deletions

View File

@@ -3,9 +3,11 @@ Log logging_handling.log testing
"""
# import atexit
import sys
from pathlib import Path
# this is for testing only
from corelibs.logging_handling.log import Log, Logger
from corelibs.debug_handling.debug_helpers import exception_stack, call_stack
from corelibs.logging_handling.logging_level_handling.logging_level import LoggingLevel
@@ -78,6 +80,8 @@ def main():
__test = 5 / 0
print(f"Divied: {__test}")
except ZeroDivisionError as e:
print(f"** sys.exec_info(): {sys.exc_info()}")
print(f"** sys.exec_info(): [{exception_stack()}] | [{exception_stack(sys.exc_info())}] | [{call_stack()}]")
log.logger.critical("Divison through zero: %s", e)
log.exception("Divison through zero: %s", e)