logviewer.py 文件源码

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

项目:django-gateone 作者: jimmy201602 项目源码 文件源码
def get_log_metadata(golog_path):
    """
    Returns the metadata from the log at the given *golog_path* in the form of
    a dict.
    """
    metadata = {}
    if not os.path.getsize(golog_path): # 0 bytes
        return metadata # Nothing to do
    try:
        first_frame, distance = retrieve_first_frame(golog_path)
    except IOError:
        # Something wrong with the log...  Probably still being written to
        return metadata
    if first_frame[14:].startswith('{'):
        # This is JSON, capture metadata
        metadata = json_decode(first_frame[14:])
    return metadata # All done
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号