I want to set breakpoints in different places of my program. However they are fired if I pass a specific argument to my program, I called it STOP_LEVEL
STOP_LEVEL = 0
def mbp(sl=-1):
if sl == STOP_LEVEL:
# I would like to print which function called this
mlog.info("break point at %s, %s", ...)
breakpoint()
Then I can create a breakpoint like
mbp(2)
and if I set stop_level to 2, it's fired.
First, I would like to know are there other standard methods for such functionality? Second, I would like to know where from my mbp function was called, I mean the caller function, filename and line number. How can I include them in my function as logging information?