advanced_descriptors/log_on_access.py
def __traceback(self) -> str:
        """Get outer traceback text for logging."""
        if not self.log_traceback:
            return ""
        exc_info = sys.exc_info()
        stack = traceback.extract_stack()
        exc_tb = traceback.extract_tb(exc_info[2])
        full_tb = stack[:1] + exc_tb  # cut decorator and build full traceback
        exc_line: typing.List[str] = traceback.format_exception_only(*exc_info[:2])
        # Make standard traceback string
        tb_text = "\nTraceback (most recent call last):\n" + "".join(traceback.format_list(full_tb)) + "".join(exc_line)
        return tb_text
def __traceback(self) -> str:
        """Get outer traceback text for logging."""
        if not self.log_traceback:
            return ""
        exc_info = sys.exc_info()
        stack = traceback.extract_stack()
        exc_tb = traceback.extract_tb(exc_info[2])
        full_tb = stack[:1] + exc_tb  # cut decorator and build full traceback
        exc_line: typing.List[str] = traceback.format_exception_only(*exc_info[:2])
        # Make standard traceback string
        tb_text = "\nTraceback (most recent call last):\n" + "".join(traceback.format_list(full_tb)) + "".join(exc_line)
        return tb_text
def __traceback ( self ) -> str : if not self . log_traceback : return "" exc_info = sys . exc_info ( ) stack = traceback . extract_stack ( ) exc_tb = traceback . extract_tb ( exc_info [ 2 ] ) full_tb = stack [ : 1 ] + exc_tb # cut decorator and build full traceback exc_line : typing . List [ str ] = traceback . format_exception_only ( * exc_info [ : 2 ] ) # Make standard traceback string tb_text = "\nTraceback (most recent call last):\n" + "" . join ( traceback . format_list ( full_tb ) ) + "" . join ( exc_line ) return tb_text
Get outer traceback text for logging.
Get outer traceback text for logging .