preheat_open.interfaces.log_method_call
- preheat_open.interfaces.log_method_call(logger=<Logger preheat_open.interfaces (WARNING)>, level='debug')
Decorator that logs method calls with their arguments.
This decorator automatically logs method calls on adapter classes, including the class name, method name, and all arguments.
- Parameters:
logger (logging.Logger) – Logger instance to use for logging
level (str) – Log level to use (default: “debug”)
- Returns:
Decorator function
- Return type:
Callable
- Example:
>>> import logging >>> test_logger = logging.getLogger("test") >>> >>> @log_method_call(logger=test_logger, level="info") ... def example_method(self, arg1, arg2=None): ... return f"Called with {arg1}, {arg2}" >>> >>> class TestClass: ... def __init__(self): ... pass >>> >>> # The decorator works on methods >>> callable(log_method_call()) True