问题描述:

I kindly ask for help in solving the following problem: accessing the stack of methods, with the "function name", "arguments" of the function (values) and the return, which has just been executed.

In short: get the chain of execution of methods, with name, arguments and return.

Is there any way to do this without putting decorators in each method?

I have already tried with the traceback module, but it does not work since it shows only the "back" string of the main method below.

I tried with the StackSummary / FrameSummary, but without success too = (

def func_a(param_a1):

print('Executing function A with: {0}'.format(param_a1))

func_b("a", "b")

return "ok"

def func_b(param_b1, param_b2):

print('Executing function B with: {0}, {1}'.format(param_b1, param_b2))

return None

def func_c():

print('Executing function C without args')

return None

if __name__ == '__main__':

# Call function_a()

func_a("testing params")

# Get here???

# call func_a("testing params")

# -> call func_b("a", "b")

# -> call func_c()

# returning None

# returning None

# returning "ok"

Thank you for your attention

相关阅读:
Top