diff --git a/EDMCLogging.py b/EDMCLogging.py index 308e85fc..479fa9bc 100644 --- a/EDMCLogging.py +++ b/EDMCLogging.py @@ -284,7 +284,25 @@ class EDMCContextFilter(logging.Filter): caller_qualname = caller_class_names = '' if frame: # - frame_info = inspect.getframeinfo(frame) + try: + frame_info = inspect.getframeinfo(frame) + raise(IndexError) # TODO: Remove, only for testing + + except Exception: + # Separate from the print below to guarantee we see at least this much. + print('EDMCLogging:EDMCContextFilter:caller_attributes(): Failed in `inspect.getframinfo(frame)`') + + # We want to *attempt* to show something about the nature of 'frame', + # but at this point we can't trust it will work. + try: + print(f'frame: {frame}') + + except Exception: + pass + + # We've given up, so just return all '??' to signal we couldn't get the info + return '??', '??', '??' + args, _, _, value_dict = inspect.getargvalues(frame) if len(args) and args[0] in ('self', 'cls'): frame_class: 'object' = value_dict[args[0]]