From 724f3072bae97ad255eaddb12c13ba9548cad361 Mon Sep 17 00:00:00 2001 From: uy/sun Date: Sat, 8 Apr 2023 10:02:24 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=81=B5=E5=AE=88=20debug=20logging=20?= =?UTF-8?q?=E7=9A=84=E8=AE=BE=E7=BD=AE=20(#123)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 4 ++++ bot.py | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b97ab945..b35b871f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/lang/zh-CN/ ## [Unreleased] +### Added + +- 遵守 debug logging 的设置 + ### Changed - 设置时区为中国 diff --git a/bot.py b/bot.py index 544b7125..fb6bca8c 100644 --- a/bot.py +++ b/bot.py @@ -74,9 +74,14 @@ def payload_to_event( with ensure_cwd(Path(__file__).parent): app_id = os.environ.get("APP_ID") private_key = os.environ.get("PRIVATE_KEY") + # https://docs.github.com/en/actions/learn-github-actions/contexts#runner-context + # 如果设置时,值总是为 "1" + runner_debug = os.environ.get("RUNNER_DEBUG", "0") nonebot.init( - driver="~none", github_apps=[{"app_id": app_id, "private_key": private_key}] + driver="~none", + github_apps=[{"app_id": app_id, "private_key": private_key}], + log_level="DEBUG" if runner_debug == "1" else "INFO", ) driver = nonebot.get_driver()