Disallow logCall() invocation on LogEvent

This commit is contained in:
JeremyStar™ 2024-07-21 21:19:10 +02:00
parent 9d3397888d
commit aaa81e2f87
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D
2 changed files with 5 additions and 2 deletions

View file

@ -22,6 +22,7 @@ package de.staropensource.sosengine.base.classes.helpers;
import de.staropensource.sosengine.base.EngineConfiguration;
import de.staropensource.sosengine.base.annotations.EventListener;
import de.staropensource.sosengine.base.classes.Event;
import de.staropensource.sosengine.base.events.LogEvent;
import de.staropensource.sosengine.base.exceptions.UnexpectedThrowableException;
import de.staropensource.sosengine.base.exceptions.reflection.InstanceMethodFromStaticContextException;
import de.staropensource.sosengine.base.exceptions.reflection.InvalidMethodSignature;
@ -144,6 +145,7 @@ public class EventHelper {
public static void invokeAnnotatedMethods(@NotNull Class<? extends Event> event, Object... arguments) {
Runnable eventCode = () -> {
LoggerInstance logger = new LoggerInstance(new LogIssuer(EventHelper.class, event.getName(), CodePart.ENGINE));
if (event != LogEvent.class)
logCall(event);
for (ReflectionMethod method : getAnnotatedMethods(event)) {

View file

@ -215,7 +215,8 @@ public final class Logger {
base = loggerImplementation.postPlaceholder(level, issuer, base);
// Call event
if (!(issuer.getClazz().getName().equals("de.staropensource.sosengine.slf4j_compat.CompatibilityLogger") || issuer.getClazz().equals(EventHelper.class)))
if (!(issuer.getClazz().getName().equals("de.staropensource.sosengine.slf4j_compat.CompatibilityLogger")
|| issuer.getClazz().equals(EventHelper.class)))
new LogEvent().callEvent(level, issuer, message);
// Print log message by invoking LoggerImpl#print