Change logging to debug level

This commit is contained in:
Dan Yeaw 2023-05-11 20:55:54 -04:00
parent 40b6f84cb0
commit a13b0a4173
No known key found for this signature in database
GPG Key ID: 86B9FEF88B780F2B
2 changed files with 6 additions and 2 deletions

View File

@ -23,6 +23,8 @@ __all__ = "multidispatch"
T = TypeVar("T", bound=Union[Callable[..., Any], type])
KeyType = Union[type, None]
logger = logging.getLogger(__name__)
def multidispatch(*argtypes: KeyType) -> Callable[[T], FunctionDispatcher[T]]:
"""Declare function as multidispatch.
@ -127,7 +129,7 @@ class FunctionDispatcher(Generic[T]):
trimmed_args = args[: self.params_arity]
rule = self.registry.lookup(*trimmed_args)
if not rule:
logging.error(self.registry._tree)
logger.debug(self.registry._tree)
raise TypeError(f"No available rule found for {trimmed_args!r}")
return rule(*args, **kwargs)

View File

@ -17,6 +17,8 @@ __all__ = ("multimethod", "has_multimethods")
C = TypeVar("C")
T = TypeVar("T", bound=Union[Callable[..., Any], type])
logger = logging.getLogger(__name__)
def multimethod(*argtypes: KeyType) -> Callable[[T], MethodDispatcher[T]]:
"""Declare method as multimethod.
@ -82,7 +84,7 @@ class MethodDispatcher(FunctionDispatcher[T]):
"""Process all unbound rule by binding them to ``cls`` type."""
for argtypes, func in self.local.unbound_rules:
argtypes = (cls,) + argtypes
logging.info("register rule", argtypes)
logger.debug("register rule", argtypes)
self.register_rule(func, *argtypes)
self.local.unbound_rules = []