debug_this.fucking_function

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

Log the execution of an unfriendly function.

Parameters:
  • logger (logging.Logger, optional) – Specify a logger instead of the default one.

  • print_parent (bool, optional) – Print which function has called the decorated function.

Examples

>>> import logging
>>> import debug_this
>>>
>>> logging.basicConfig(level=logging.DEBUG)
>>>
>>> logger = logging.getLogger(__name__)
>>>
>>> @debug_this.fucking_function(logger)
>>> def example_function():
...     logger.info("This is an example function")
>>>
>>> example_function()
DEBUG:__main__:  >>> example_function
INFO:__main__:This is an example function
DEBUG:__main__:  <<< example_function