V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
jenlors
V2EX  ›  Python

alarmer,自动报告你的 Python 程序错误

  •  
  •   jenlors · Oct 1, 2021 · 3982 views
    This topic created in 1670 days ago, the information mentioned may be changed or developed.

    项目地址: https://github.com/long2ice/alarmer

    在程序错误报告这方面,sentry 已经做的很好了,但是 sentry 实在太重了,自己搭建的话很耗资源,sass 免费版本又有额度限制,在某些情况下,我们需要一个轻量替代品,只需要在程序发生异常的时候报告给开发者就可以了。

    开源项目找了一圈,没有找到合适的,遂打算自己写一个,于是有了 alarmer 。

    使用很简单,只需要在程序开始处调用一下 init 方法。

    import os
    
    from alarmer import Alarmer
    from alarmer.provider.feishu import FeiShuProvider
    
    
    def main():
        Alarmer.init(providers=[FeiShuProvider(webhook_url=os.getenv("FEI_SHU_WEBHOOK_URL"))])
        raise Exception("test")
    
    
    if __name__ == "__main__":
        main()
    
    

    当前版本支持报告至飞书机器人、企业微信机器人、邮箱,后续会支持更多渠道。

    希望各位不吝 star !感谢~

    10 replies    2021-10-08 17:08:39 +08:00
    zhlxsh
        1
    zhlxsh  
       Oct 1, 2021 via iPhone
    加入收藏👍
    bpf2049
        2
    bpf2049  
       Oct 1, 2021
    如果有生成的报告截图,应该会更吸引人
    ch2
        3
    ch2  
       Oct 1, 2021 via iPhone
    能自定义报告发送方式吗
    Varchar
        4
    Varchar  
       Oct 1, 2021 via iPhone
    不错不错 稍晚些 研究下源码
    jenlors
        5
    jenlors  
    OP
       Oct 1, 2021
    可以自定义
    jenlors
        6
    jenlors  
    OP
       Oct 1, 2021
    @suifengdang666 具体是指什么?目前是会发送异常堆栈信息
    txoooy
        7
    txoooy  
       Oct 1, 2021
    支持楼主, 还没试, 不过 provider 可以是一个函数不, 自由度更高一点
    jenlors
        8
    jenlors  
    OP
       Oct 1, 2021
    @txoooy 后面可以考虑支持一下
    3t
        9
    3t  
       Oct 2, 2021
    star~
    jenlors
        10
    jenlors  
    OP
       Oct 8, 2021
    @3t 感谢!
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5066 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 50ms · UTC 09:47 · PVG 17:47 · LAX 02:47 · JFK 05:47
    ♥ Do have faith in what you're doing.