EaglerForge/sources/main/java/net/eaglerforge/api/LoggerAPI.java

39 lines
1.3 KiB
Java
Raw Permalink Normal View History

2024-02-16 10:43:17 -06:00
package net.eaglerforge.api;
import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
import net.lax1dude.eaglercraft.v1_8.log4j.Logger;
public class LoggerAPI {
2024-02-22 07:09:44 -06:00
public static Logger log = LogManager.getLogger();
2024-02-16 10:43:17 -06:00
public static ModData makeModData() {
ModData loggerGlobal = new ModData();
2024-02-22 07:09:44 -06:00
loggerGlobal.setCallbackVoidWithDataArg("setlogger", (BaseData params) -> {
log = LogManager.getLogger(params.getString("name"));
});
2024-02-16 10:43:17 -06:00
loggerGlobal.setCallbackVoidWithDataArg("loginfo", (BaseData params) -> {
log.info(params.getString("string"));
});
loggerGlobal.setCallbackVoidWithDataArg("logdebug", (BaseData params) -> {
log.debug(params.getString("string"));
});
loggerGlobal.setCallbackVoidWithDataArg("logerror", (BaseData params) -> {
log.error(params.getString("string"));
});
loggerGlobal.setCallbackVoidWithDataArg("logwarn", (BaseData params) -> {
log.warn(params.getString("string"));
});
loggerGlobal.setCallbackVoidWithDataArg("logfatal", (BaseData params) -> {
log.fatal(params.getString("string"));
});
loggerGlobal.setCallbackVoidWithDataArg("logtrace", (BaseData params) -> {
log.trace(params.getString("string"));
});
return loggerGlobal;
}
}