Skip to main content

logging的飞书handler

Project description

feishu-logging-handler

通过webhook将自定义服务的消息推送至飞书

特点:

  • 异步有可能会遇到loop已释放的问题,调整为同步。启用多线程,所以性能ok
  • 增加缓存支持,重复消息设置一个时间周期,不会重复发送
  • 支持 filter_key 来过滤部分error的key

安装

pip install feishu-logging-handler -i https://pypi.org/simple

配置

  • 创建一个飞书群组
  • 点击群设置,添加一个机器人,并生成Webhook地址
  • 可以设置关键词过滤

使用方式

初始化:

from feishu_logging.handler import FeiShuWebhookHandler
log_feishu = logging.getLogger("feishu")
http_handler = FeiShuWebhookHandler("https://open.feishu.cn/open-apis/bot/v2/hook/xxx","key_word",cache_time=0,filter_key=["funcName","msg","levelname","args","pathname","filename","threadName"]) # 0为不启用cache
http_handler.setLevel(logging.DEBUG)
log_feishu.addHandler(http_handler)

写日志:

log_feishu = logging.getLogger("feishu")
log_feishu.error("错误测试")

填入Webhook地址和关键词(或项目名称)即可

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

feishu_logging_handler-1.0.4.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

feishu_logging_handler-1.0.4-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file feishu_logging_handler-1.0.4.tar.gz.

File metadata

File hashes

Hashes for feishu_logging_handler-1.0.4.tar.gz
Algorithm Hash digest
SHA256 8c267b58e8d667728588485078506b5a6775972456f77a5b7f76a16b6882435b
MD5 52bb8d8970ac085e318dfdb8d29bb106
BLAKE2b-256 3d6147ff8fdf065558233e905a01e61b5f210121c22882900331ca4c5cfa50ef

See more details on using hashes here.

File details

Details for the file feishu_logging_handler-1.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for feishu_logging_handler-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 b2070585614cf788f5552ad9f7a32e1f914fd037b5f22d09e8010d3a9dd6a9ce
MD5 bfc097bc1c23e463c17f2315a8210814
BLAKE2b-256 3243362d52fb6508a3acb7cc84dfb95c300ed7b26353f07a51f26e9765c4ed4c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page