Skip to content

Commit

Permalink
✨ 使用env中的日志等级记录日志
Browse files Browse the repository at this point in the history
  • Loading branch information
HibiKier committed Jan 7, 2025
1 parent d274b18 commit 10f70fe
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion zhenxun/services/log.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from datetime import datetime, timedelta
from typing import Any, overload

import nonebot
from nonebot import require

require("nonebot_plugin_session")
Expand All @@ -11,9 +12,13 @@

from zhenxun.configs.path_config import LOG_PATH

driver = nonebot.get_driver()

log_level = driver.config.log_level or "INFO"

logger_.add(
LOG_PATH / f"{datetime.now().date()}.log",
level="INFO",
level=log_level,
rotation="00:00",
format=default_format,
filter=default_filter,
Expand Down

0 comments on commit 10f70fe

Please sign in to comment.