🔊 add trace logs

This commit is contained in:
yanyongyu 2021-12-24 15:04:18 +08:00
parent 6643f951ef
commit 6ed87f1910
4 changed files with 18 additions and 5 deletions

View File

@ -216,11 +216,13 @@ def _resolve_combine_expr(obj_str: str) -> Type[Driver]:
drivers[0], "Driver", default_prefix="nonebot.drivers."
)
if len(drivers) == 1:
logger.trace(f"Detected driver {DriverClass} with no mixins.")
return DriverClass
mixins = [
_resolve_dot_notation(mixin, "Mixin", default_prefix="nonebot.drivers.")
for mixin in drivers[1:]
]
logger.trace(f"Detected driver {DriverClass} with mixins {mixins}.")
return combine_driver(DriverClass, *mixins)

View File

@ -152,6 +152,12 @@ class Dependent(Generic[R]):
)
)
logger.trace(
f"Parsed dependent with call={call}, "
f"params={[param.field_info for param in dependent.params]}, "
f"parameterless={dependent.parameterless}"
)
return dependent
async def solve(

View File

@ -249,7 +249,6 @@ class Matcher(metaclass=MatcherMeta):
- ``Type[Matcher]``: 新的事件响应器类
"""
NewMatcher = type(
"Matcher",
(Matcher,),
@ -282,6 +281,8 @@ class Matcher(metaclass=MatcherMeta):
},
)
logger.trace(f"Define new matcher {NewMatcher}")
matchers[priority].append(NewMatcher)
return NewMatcher
@ -703,6 +704,10 @@ class Matcher(metaclass=MatcherMeta):
stack: Optional[AsyncExitStack] = None,
dependency_cache: Optional[T_DependencyCache] = None,
):
logger.trace(
f"Matcher {self} run with incoming args: "
f"bot={bot}, event={event}, state={state}"
)
b_t = current_bot.set(bot)
e_t = current_event.set(event)
m_t = current_matcher.set(self)

8
poetry.lock generated
View File

@ -393,7 +393,7 @@ http2 = ["h2 (>=3,<5)"]
[[package]]
name = "hypercorn"
version = "0.13.1"
version = "0.13.2"
description = "A ASGI Server based on Hyper libraries and inspired by Gunicorn"
category = "main"
optional = true
@ -555,7 +555,7 @@ pytest-asyncio = "^0.16.0"
type = "git"
url = "https://github.com/nonebot/nonebug.git"
reference = "master"
resolved_reference = "6e2292f06b0b06dc2e1353ed1ef248a6c91fa2e4"
resolved_reference = "afc3c3fe2cf6300cdf1b5e1a897867a03a17e278"
[[package]]
name = "packaging"
@ -1636,8 +1636,8 @@ httpx = [
{file = "httpx-0.21.1.tar.gz", hash = "sha256:02af20df486b78892a614a7ccd4e4e86a5409ec4981ab0e422c579a887acad83"},
]
hypercorn = [
{file = "Hypercorn-0.13.1-py3-none-any.whl", hash = "sha256:fcbfd5b691176cfcbf558cfa536909b2ef249af5528c99fcf941405c1c9aba74"},
{file = "Hypercorn-0.13.1.tar.gz", hash = "sha256:3f55c7d0a51a93601d24fb773b88b1cd05c8ccb33e19294d1215bc0e19a6939c"},
{file = "Hypercorn-0.13.2-py3-none-any.whl", hash = "sha256:ca18f91ab3fa823cbe9e949738f9f2cc07027cd647c80d8f93e4b1a2a175f112"},
{file = "Hypercorn-0.13.2.tar.gz", hash = "sha256:6307be5cbdf6ba411967d4661202dc4f79bd511b5d318bc4eed88b09418427f8"},
]
hyperframe = [
{file = "hyperframe-6.0.1-py3-none-any.whl", hash = "sha256:0ec6bafd80d8ad2195c4f03aacba3a8265e57bc4cff261e802bf39970ed02a15"},