V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
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 · 2021-10-01 10:05:04 +08:00 · 2927 次点击
    这是一个创建于 910 天前的主题,其中的信息可能已经有所发展或是发生改变。

    项目地址: 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 条回复    2021-10-08 17:08:39 +08:00
    zhlxsh
        1
    zhlxsh  
       2021-10-01 10:41:18 +08:00 via iPhone
    加入收藏👍
    suifengdang666
        2
    suifengdang666  
       2021-10-01 12:42:07 +08:00
    如果有生成的报告截图,应该会更吸引人
    ch2
        3
    ch2  
       2021-10-01 12:59:01 +08:00 via iPhone
    能自定义报告发送方式吗
    Varchar
        4
    Varchar  
       2021-10-01 13:47:58 +08:00 via iPhone
    不错不错 稍晚些 研究下源码
    jenlors
        5
    jenlors  
    OP
       2021-10-01 13:52:35 +08:00
    可以自定义
    jenlors
        6
    jenlors  
    OP
       2021-10-01 13:53:30 +08:00
    @suifengdang666 具体是指什么?目前是会发送异常堆栈信息
    txoooy
        7
    txoooy  
       2021-10-01 19:38:42 +08:00
    支持楼主, 还没试, 不过 provider 可以是一个函数不, 自由度更高一点
    jenlors
        8
    jenlors  
    OP
       2021-10-01 19:42:38 +08:00
    @txoooy 后面可以考虑支持一下
    3t
        9
    3t  
       2021-10-02 16:47:45 +08:00
    star~
    jenlors
        10
    jenlors  
    OP
       2021-10-08 17:08:39 +08:00
    @3t 感谢!
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   4459 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 10:03 · PVG 18:03 · LAX 03:03 · JFK 06:03
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.