package net.aeronica.mods.mxtune.util;

import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.Logger;

public class ModLogger {

    private static Logger logger;

    public static void setLogger(Logger logger) {
        if (ModLogger.logger != null) {
            throw new IllegalStateException("Attempt to replace logger");
        }
        ModLogger.logger = logger;
    }

    public static void log(Level level, String format, Object... data) {
        logger.printf(level, format, data);
    }
    
    public static void info(String format, Object... data){
        log(Level.INFO, format, data);
    }
    
    public static void debug(String format, Object... data){
        log(Level.DEBUG, format, data);
    }
    
    public static void warning(String format, Object... data){
        log(Level.WARN, format, data);
    }

    public static void error(String format, Object... data){
        log(Level.ERROR, format, data);
    }

    public static void fatal(String format, Object... data){
        log(Level.FATAL, format, data);
    }

    public static <T extends Exception> void error(T e)
    {
        logger.error(e.getStackTrace());
    }
}

@@ -510,32 +510,519 @@
 ta);%0A    %7D%0A    %0A
+    /**%0A     * Log a stack trace for &lt;T extends Exception&gt; %7B@link e%7D at the specified log %7B@link level%7D%0A     * @param level     The specified log level%0A     * @param e         The raw exception %0A     */%0A    public static %3CT extends Exception%3E void log(Level level, T e)%0A    %7B%0A        if (e != null) %7B%0A            log(level, %22%25s%22, e.getLocalizedMessage());%0A            for(StackTraceElement s: e.getStackTrace())%0A                log(level, %22%25s%22, s.toString());%0A        %7D%0A    %7D%0A    %0A
     public stati
@@ -1560,104 +1560,1222 @@
     
-public static %3CT extends Exception%3E void error(T e)%0A    %7B%0A        logger.error(e.getStackTrace()
+/**%0A     * Log a stack trace for &lt;T extends Exception&gt; %7B@link e%7D at log Level.INFO%0A     * @param e         The raw exception %0A     */%0A    public static %3CT extends Exception%3E void info(T e)%0A    %7B%0A        log(Level.INFO, e);%0A    %7D%0A    %0A    /**%0A     * Log a stack trace for &lt;T extends Exception&gt; %7B@link e%7D at log Level.DEBUG%0A     * @param e         The raw exception %0A     */%0A    public static %3CT extends Exception%3E void debug(T e)%0A    %7B%0A        log(Level.DEBUG, e);%0A    %7D%0A    %0A    /**%0A     * Log a stack trace for &lt;T extends Exception&gt; %7B@link e%7D at log Level.WARM%0A     * @param e         The raw exception %0A     */%0A    public static %3CT extends Exception%3E void warning(T e)%0A    %7B%0A        log(Level.WARN, e);%0A    %7D%0A    %0A    /**%0A     * Log a stack trace for &lt;T extends Exception&gt; %7B@link e%7D at log Level.ERROR%0A     * @param e         The raw exception %0A     */%0A    public static %3CT extends Exception%3E void error(T e)%0A    %7B%0A        log(Level.ERROR, e);%0A    %7D%0A    %0A    /**%0A     * Log a stack trace for &lt;T extends Exception&gt; %7B@link e%7D at log Level.FATAL%0A     * @param e         The raw exception %0A     */%0A    public static %3CT extends Exception%3E void fatal(T e)%0A    %7B%0A        log(Level.FATAL, e
 );%0A 
@@ -2779,10 +2779,15 @@
 ;%0A    %7D%0A
+    %0A
 %7D%0A

Add exception stack trace logging to the ModLogger.