add Logging to various locations #11

Merged
tueem merged 18 commits from feat/logging into dev 2024-12-20 17:51:24 +00:00
Showing only changes of commit 7a40aebd6d - Show all commits

View File

@ -7,6 +7,8 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import org.apache.logging.log4j.Logger;
import net.tomatentum.marinara.Marinara; import net.tomatentum.marinara.Marinara;
import net.tomatentum.marinara.checks.AppliedCheck; import net.tomatentum.marinara.checks.AppliedCheck;
import net.tomatentum.marinara.interaction.InteractionHandler; import net.tomatentum.marinara.interaction.InteractionHandler;
@ -16,6 +18,7 @@ import net.tomatentum.marinara.interaction.commands.annotation.SlashCommand;
import net.tomatentum.marinara.interaction.commands.annotation.SubCommand; import net.tomatentum.marinara.interaction.commands.annotation.SubCommand;
import net.tomatentum.marinara.parser.AnnotationParser; import net.tomatentum.marinara.parser.AnnotationParser;
import net.tomatentum.marinara.parser.InteractionCheckParser; import net.tomatentum.marinara.parser.InteractionCheckParser;
import net.tomatentum.marinara.util.LoggerUtil;
public abstract class InteractionMethod { public abstract class InteractionMethod {
@ -33,6 +36,8 @@ public abstract class InteractionMethod {
protected List<AnnotationParser> parsers; protected List<AnnotationParser> parsers;
protected List<AppliedCheck> appliedChecks; protected List<AppliedCheck> appliedChecks;
private Logger logger = LoggerUtil.getLogger(getClass());
protected InteractionMethod(Method method, protected InteractionMethod(Method method,
InteractionHandler handler, InteractionHandler handler,
Marinara marinara Marinara marinara
@ -82,11 +87,14 @@ public abstract class InteractionMethod {
List<Object> parameters = new ArrayList<>(); List<Object> parameters = new ArrayList<>();
for (int i = 0; i < parameterCount; i++) { for (int i = 0; i < parameterCount; i++) {
Object parameter;
if (i == 0) { if (i == 0) {
parameters.add(context); parameter = context;
continue; }else
} parameter = getParameter(context, i-1);
parameters.add(getParameter(context, i-1));
logger.trace("Found parameter {}={} for {}", parameter.getClass().toString(), parameter, getMethod().getClass().getName() + "." + getMethod().getName());
parameters.add(parameter);
} }
return parameters.toArray(); return parameters.toArray();
} }