https://github.com/a-kirami/nonebot-plugin-logpile
https://github.com/a-kirami/nonebot-plugin-logpile
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/a-kirami/nonebot-plugin-logpile
- Owner: A-kirami
- License: mit
- Created: 2023-05-09T17:40:10.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2025-02-06T07:19:49.000Z (5 months ago)
- Last Synced: 2025-04-17T19:18:24.561Z (3 months ago)
- Language: Python
- Size: 38.1 KB
- Stars: 9
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## 📖 介绍
将 nonebot 的日志记录保存到本地文件
## 💿 安装
使用 nb-cli 安装
在 nonebot2 项目的根目录下打开命令行, 输入以下指令即可安装nb plugin install nonebot-plugin-logpile
使用包管理器安装
在 nonebot2 项目的插件目录下, 打开命令行, 根据你使用的包管理器, 输入相应的安装命令pip
pip install nonebot-plugin-logpile
pdm
pdm add nonebot-plugin-logpile
poetry
poetry add nonebot-plugin-logpile
conda
conda install nonebot-plugin-logpile
打开 nonebot2 项目根目录下的 `pyproject.toml` 文件, 在 `[tool.nonebot]` 部分追加写入
plugins = ["nonebot_plugin_logpile"]
## ⚙️ 配置
在 nonebot2 项目的`.env`文件中添加下表中的必填配置
| 配置项 | 必填 | 默认值 | 说明 |
| :-----------------: | :--: | :------: | :------------------------------------------------------------------------------------------------------------: |
| `LOGPILE_PATH` | 否 | `./logs` | 日志文件保存路径,默认保存在当前工作目录下的 `logs` 文件夹中 |
| `LOGPILE_LEVEL` | 否 | `ERROR` | 日志保存等级,可以为列表或者字符串。如果是字符串,那么保存当前等级及以上所有等级的日志,否则只保存列表中的等级 |
| `LOGPILE_RETENTION` | 否 | `14` | 日志文件保留时长,默认保留 14 天,自动清理过期日志 |