def debug_msg(status): caller_levels = dict(troubleshoot_cleaner=1, troubleshoot_obj_call=2, troubleshoot_test=3) frame = gfi(gof(cf(caller_levels['troubleshoot_test']))[1][0]) print("{} [filename: {}, line: {}]".format(status, frame.filename, frame.lineno))
def _set_frame(self, kargs): if 'frame' in kargs: self.frame = kargs['frame'] else: # gof gets a stack of [inner->outer] tuples. tuple[0] is frame self.frame = gfi(gof(cf())[2][0])