logs.py 文件源码

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

项目:siphon-cli 作者: getsiphon 项目源码 文件源码
def stream_logs():
    conf = Config()
    # Request the correct streamer URL from siphon-web
    auth = Auth()
    siphon = Siphon(auth.auth_token)

    # Track
    mixpanel_event(MIXPANEL_EVENT_LOGS, properties={'app_id': conf.app_id})

    streamer_url = siphon.get_streamer_url(conf.app_id, 'log_reader')

    puts(colored.yellow('Connecting...'))
    ws = websocket.create_connection(streamer_url)
    puts(colored.green('Streaming logs and errors... (ctrl-c to stop)\n'))
    try:
        for line in ws:
            print(line)
    except KeyboardInterrupt:
        puts(colored.yellow('\nClosing the connection.'))
        ws.close()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号