sim_soft_ctrl.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:simLAB 作者: kamwar 项目源码 文件源码
def logFunctionAndArgs(self):
        frame = inspect.getouterframes(inspect.currentframe())[1][0]
        args, _, _, values = inspect.getargvalues(frame)
        frameinfo = inspect.getframeinfo(frame)
        functionName=inspect.getframeinfo(frame)[2]
        output = ""
        for arg in args[1:]: #[1:] skip the first argument 'self'
            value = values[arg]
            if isinstance(value, str):
                #add apostrophes for string values
                value = "\'"+value+"\'"
            elif isinstance(value, int):
                value = ''.join('%02X' % value)
            else:
                newValue = ""
                for i in value:
                    if isinstance(i, int):
                        newValue += '%02X' % i
                    else:
                        newValue += str(i)
                value = newValue
            output += arg + '=' + value
            if arg != args[-1]:
                #add comma if not the last element
                output +=','
        #do not print "\n' as a new line
        output = output.replace("\n","\\n")
        self.logging.info("--> "+functionName+'('+output+')')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号