debug_this.fucking_class

debug_this.fucking_class(*args_d: Any, **kwargs_d: Any) Any[source]

Log the execution of an unfriendly class.

This decorator configures the fucking_function decorator on each method of the specified class. All available parameters for the fucking_function decorator can be used.

See also

fucking_function

Examples

>>> import logging
>>> import debug_this
>>>
>>> logging.basicConfig(level=logging.DEBUG)
>>>
>>> logger = logging.getLogger(__name__)
>>>
>>> @debug_this.fucking_class(logger)
>>> class ExampleClass:
...     def __init__(self):
...         logger.info("Example constructor")
...
...     def example_method(self):
...         logger.info("Example method")
>>>
>>> e = ExampleClass()
>>> e.example_method()
DEBUG:__main__:  >>> ExampleClass.__init__
INFO:__main__:Example constructor
DEBUG:__main__:  <<< ExampleClass.__init__
DEBUG:__main__:  >>> ExampleClass.example_method
INFO:__main__:Example method
DEBUG:__main__:  <<< ExampleClass.example_method