@@ -0,0 +1,1408 @@
+package vg.civcraft.mc.civmodcore.util;%0A%0Aimport com.google.common.base.Strings;%0Aimport java.util.logging.LogRecord;%0Aimport java.util.logging.Logger;%0Aimport org.bukkit.plugin.java.PluginClassLoader;%0A%0Apublic final class CivLogger extends Logger %7B%0A%0A%09private final String prefix;%0A%0A%09private CivLogger(final Logger logger, final String prefix) %7B%0A%09%09super(logger.getName(), logger.getResourceBundleName());%0A%09%09setParent(logger);%0A%09%09this.prefix = prefix;%0A%09%7D%0A%0A%09@Override%0A%09public void log(final LogRecord record) %7B%0A%09%09if (!Strings.isNullOrEmpty(this.prefix)) %7B%0A%09%09%09record.setMessage(%22%5B%22 + this.prefix + %22%5D %22 + record.getMessage());%0A%09%09%7D%0A%09%09super.log(record);%0A%09%7D%0A%0A%09/**%0A%09 * Creates a logger based on a given class. If the given class was loaded by a plugin, it will piggy back off that%0A%09 * plugin's logger.%0A%09 *%0A%09 * @param clazz The class to base the logger on.%0A%09 * @return Returns a new civ logger.%0A%09 */%0A%09public static CivLogger getLogger(final Class%3C?%3E clazz) %7B%0A%09%09if (clazz == null) %7B%0A%09%09%09return new CivLogger(Logger.getLogger(CivLogger.class.getSimpleName()), null);%0A%09%09%7D%0A%09%09final ClassLoader classLoader = clazz.getClassLoader();%0A%09%09if (!(classLoader instanceof PluginClassLoader)) %7B%0A%09%09%09return new CivLogger(Logger.getLogger(CivLogger.class.getSimpleName()), clazz.getSimpleName());%0A%09%09%7D%0A%09%09final var plugin = ((PluginClassLoader) classLoader).getPlugin();%0A%09%09return new CivLogger(plugin.getLogger(), clazz.getSimpleName());%0A%09%7D%0A%0A%7D%0A

Add CivLogger