super_gradients.common.decorators package
Submodules
super_gradients.common.decorators.deci_logger module
- super_gradients.common.decorators.deci_logger.deci_class_logger()[source]
This decorator wraps every class method with deci_func_logger decorator. It works by checking if class method is callable and if so it will set a new decorated method as the same method name.
- super_gradients.common.decorators.deci_logger.deci_func_logger(_func=None, *, name: str = 'abstract_decorator')[source]
This decorator is used to wrap our functions with logs. It will log every enter and exit of the functon with the equivalent parameters as extras. It will also log exceptions that raises in the function. It will also log the exception time of the function.
- How it works:`
First it will check if the decorator called with name keyword. If so it will return a new decorator that its logger is the name parameter. If not it will return a new decorator that its logger is the wrapped function name. Then the return decorator will return a new function that warps the original function with the new logs. For further understanding advise real-python “fancy decorators documentation”
- Args:
_func (): used when called without name specify. dont pass it directly name (): The name of the logger to save logs by.
- Returns:
a decorator that wraps function with logs logic.