Compare commits

..

No commits in common. "a5737b9eaa7b43077e2d277c103cef7c71c140b0" and "4c5e28b679c333ab3af8427640d93ad31e0446f8" have entirely different histories.

4 changed files with 2 additions and 61 deletions

View File

@ -59,7 +59,7 @@ public class SlashCommandParser implements AnnotationParser {
.build(isAutoComplete); .build(isAutoComplete);
} }
logger.trace("Parsed using SlashCommandParser for method {} with the result: {}", ReflectionUtil.getFullMethodName(method), lastIdentifier.toString()); logger.trace("Parsed using SlashCommandParser for method {} with the result:\n{}", ReflectionUtil.getFullMethodName(method), lastIdentifier.toString());
consumer.accept((SlashCommandIdentifier) lastIdentifier); consumer.accept((SlashCommandIdentifier) lastIdentifier);
} }

View File

@ -2,12 +2,9 @@ package net.tomatentum.marinara.util;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.slf4j.helpers.NOPLoggerFactory;
public class LoggerUtil { public class LoggerUtil {
public static Logger getLogger(String name) { public static Logger getLogger(String name) {
if (LoggerFactory.getILoggerFactory() instanceof NOPLoggerFactory)
return new SimpleLogger(name);
return LoggerFactory.getLogger(name); return LoggerFactory.getLogger(name);
} }

View File

@ -102,6 +102,6 @@ public final class ReflectionUtil {
} }
public static String getFullMethodName(Method method) { public static String getFullMethodName(Method method) {
return method.getDeclaringClass().getName() + "." + method.getName(); return method.getClass().getName() + "." + method.getName();
} }
} }

View File

@ -1,56 +0,0 @@
package net.tomatentum.marinara.util;
import org.slf4j.Marker;
import org.slf4j.event.Level;
import org.slf4j.helpers.LegacyAbstractLogger;
import org.slf4j.helpers.MessageFormatter;
public class SimpleLogger extends LegacyAbstractLogger {
private String name;
public SimpleLogger(String name) {
this.name = name;
}
@Override
public boolean isTraceEnabled() {
return true;
}
@Override
public boolean isDebugEnabled() {
return true;
}
@Override
public boolean isInfoEnabled() {
return true;
}
@Override
public boolean isWarnEnabled() {
return true;
}
@Override
public boolean isErrorEnabled() {
return true;
}
@Override
protected String getFullyQualifiedCallerName() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getFullyQualifiedCallerName'");
}
@Override
protected void handleNormalizedLoggingCall(Level level, Marker marker, String messagePattern, Object[] arguments,
Throwable throwable) {
String formatted = MessageFormatter.basicArrayFormat(messagePattern, arguments);
System.out.println("[%s] %s => %s".formatted(level, this.name, formatted));
}
}