Created
November 13, 2018 11:32
-
-
Save codeslord/9405fb4e81fa9b40bd102e5e0597199c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
def tracefunc(frame, event, arg, indent=[0]): | |
if event == "call": | |
indent[0] += 2 | |
print("-" * indent[0] + "> call function", frame.f_code.co_name) | |
elif event == "return": | |
print("<" + "-" * indent[0], "exit function", frame.f_code.co_name) | |
indent[0] -= 2 | |
return tracefunc | |
sys.setprofile(tracefunc) | |
main() #or whatever function you wanna trigger |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment