From acbfd6b1895d880726fde35c6c784f4872eba911 Mon Sep 17 00:00:00 2001 From: JeremyStarTM Date: Tue, 11 Jun 2024 16:35:01 +0200 Subject: [PATCH] Add event logging --- .../base/classes/helpers/EventHelper.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/base/src/main/java/de/staropensource/sosengine/base/classes/helpers/EventHelper.java b/base/src/main/java/de/staropensource/sosengine/base/classes/helpers/EventHelper.java index f69c610..c0e665b 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/classes/helpers/EventHelper.java +++ b/base/src/main/java/de/staropensource/sosengine/base/classes/helpers/EventHelper.java @@ -21,6 +21,8 @@ package de.staropensource.sosengine.base.classes.helpers; import de.staropensource.sosengine.base.annotations.EventListener; import de.staropensource.sosengine.base.classes.Event; +import de.staropensource.sosengine.base.logging.Logger; +import de.staropensource.sosengine.base.types.LogIssuer; import lombok.Getter; import org.jetbrains.annotations.NotNull; import org.reflections.Reflections; @@ -45,6 +47,16 @@ public class EventHelper { */ public EventHelper() {} + /** + * Logs the event call. + * + * @param clazz event class + * @since 1-alpha0 + */ + @NotNull + public static void logCall(Class clazz) { + Logger.diag(new LogIssuer(clazz), "Event " + clazz.getName() + " called"); + } /** * Returns all annotated methods. @@ -81,6 +93,8 @@ public class EventHelper { * @since 1-alpha0 */ public static void invokeAnnotatedMethods(Class clazz) { + logCall(clazz); + for (Method method : getAnnotatedMethods(clazz)) { try { method.invoke(null);