Add logging for registered hooks

This commit is contained in:
Frisk 2023-10-11 21:38:31 +02:00
parent 8eb01129fe
commit be726cc955

View file

@ -13,8 +13,10 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with RcGcDw. If not, see <http://www.gnu.org/licenses/>. # along with RcGcDw. If not, see <http://www.gnu.org/licenses/>.
import logging
import src.api.hooks import src.api.hooks
logger = logging.getLogger("src.api.hook")
def pre_hook(func): def pre_hook(func):
""" """
@ -22,6 +24,7 @@ def pre_hook(func):
:return: func :return: func
""" """
logger.info("{hook_name} has been registered as a pre hook.".format(hook_name=func.__name__))
src.api.hooks.pre_hooks.append(func) src.api.hooks.pre_hooks.append(func)
return func return func
@ -32,5 +35,6 @@ def post_hook(func):
:return: func :return: func
""" """
logger.info("{hook_name} has been registered as a post hook.".format(hook_name=func.__name__))
src.api.hooks.post_hooks.append(func) src.api.hooks.post_hooks.append(func)
return func return func