Skip to main content

在使用 nonebot 自带的 logger 写入 ERROR 级别以上的日志时,会自动发送至钉钉机器人

Project description

NoneBotPluginLogo

NoneBotPluginText

nonebot-plugin-dingtalk-logger

✨ 将错误日志推送至钉钉机器人的 NoneBot 插件 ✨

license pypi python

📖 介绍

在使用 nonebot 自带的 logger 写入 ERROR 级别以上的日志时,会自动发送至钉钉机器人

from nonebot import logger

try:
    0 / 0
except:
    logger.exception("计算错误")

💿 安装

使用 nb-cli 安装 在 nonebot2 项目的根目录下打开命令行, 输入以下指令即可安装
nb plugin install nonebot-plugin-dingtalk-logger
使用包管理器安装 在 nonebot2 项目的插件目录下, 打开命令行, 根据你使用的包管理器, 输入相应的安装命令
pip
pip install nonebot-plugin-dingtalk-logger
pdm
pdm add nonebot-plugin-dingtalk-logger
poetry
poetry add nonebot-plugin-dingtalk-logger
conda
conda install nonebot-plugin-dingtalk-logger

打开 nonebot2 项目根目录下的 pyproject.toml 文件, 在 [tool.nonebot] 部分追加写入

plugins = ["nonebot_plugin_dingtalk_logger"]

⚙️ 配置

在 nonebot2 项目的.env文件中添加下表中的必填配置

配置项 必填 默认值 说明
DINGTALK_TOKEN 调用接口的凭证,钉钉提供的 Webhook 链接中 access_token 的值
DINGTALK_SECRET "" 安全密钥,安全设置项选择了加签后,提供的 SEC 开头的字符串
DINGTALK_KEYWORDS [] 自定义关键词,创建机器人时在安全设置项填入的所有关键词
DINGTALK_TIMEOUT -1 全局请求超时时间,值为正时生效

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

nonebot_plugin_dingtalk_logger-0.0.0.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file nonebot_plugin_dingtalk_logger-0.0.0.tar.gz.

File metadata

File hashes

Hashes for nonebot_plugin_dingtalk_logger-0.0.0.tar.gz
Algorithm Hash digest
SHA256 40fb98cef7abe33983f2f41785b1990f38fcdf1b7011b6d1128cef3ce90c8efd
MD5 602f7e1f0b373d0cdf2de9456a02aa6b
BLAKE2b-256 ebcd2bfcca2f4f5c65de5b5f705de85f7c9ac61d8186ffaafeac8118da96efb5

See more details on using hashes here.

File details

Details for the file nonebot_plugin_dingtalk_logger-0.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for nonebot_plugin_dingtalk_logger-0.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 090eb2bcb680d8e70814e3a2b77db5c30d5f78fecc435a7506d0d474e8445a82
MD5 c7d43b06194ca463c54bf0cd6a0cf534
BLAKE2b-256 a0eec9162cc6d12eb52da7561519a42a13584235ab7a3ecaa12afce45acb8bdb

See more details on using hashes here.

Supported by

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