filestore.py 文件源码

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

项目:actsys 作者: intel-ctrlsys 项目源码 文件源码
def log_formatter(line):
        split = line.split(' / ')
        if len(split) == 4:
            return {
                # Other parsing options: http://stackoverflow.com/questions/466345/converting-string-into-datetime
                #
                "timestamp": date_parse(split[0] + "+00"),
                "level": logging.getLevelName(split[1]),
                "message": split[3],
                "process": split[2],
                "device_id": None,
            }
        elif len(split) == 6:
            return {
                # Other parsing options: http://stackoverflow.com/questions/466345/converting-string-into-datetime
                "timestamp": date_parse(split[0]),
                "level": logging.getLevelName(split[1]),
                "message": split[5],
                "process": split[3],
                "device_id": split[4],
            }
        else:
            raise RuntimeError("The logs in the log file are of an unknown format, cannot continue. "
                               "Line: {}".format(line))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号