package xyz.upperlevel.uppercore.util;

import xyz.upperlevel.uppercore.Uppercore;

public class Dbg {
    private static boolean active = true;

    /**
     * Prints the message on console only if the debug mode is active.
     * @param message The message to print.
     */
    public static void p(String message) {
        if (active) {
            String callerName = "?";
            try {
                Class<?> caller = Class.forName(new Exception().getStackTrace()[1].getClassName());
                callerName = caller.getSimpleName();
            } catch (ClassNotFoundException ignored) {
            }
            Uppercore.logger().info(String.format("[%s] %s", callerName, message));
        }
    }

    public static void loadConfig() {
    }
}

@@ -147,145 +147,249 @@
     
-/**%0A     * Prints the message on console only if the debug mode is active.%0A     * @param message The message to print.%0A     */%0A    public
+private static Class%3C?%3E getCaller() %7B%0A        try %7B%0A            return Class.forName(new Exception().getStackTrace()%5B2%5D.getClassName());%0A        %7D catch (ClassNotFoundException ignored) %7B%0A            return null;%0A        %7D%0A    %7D%0A%0A    private
  sta
@@ -398,16 +398,17 @@
 c void p
+0
 (String 
@@ -414,16 +414,33 @@
  message
+, Class%3C?%3E caller
 ) %7B%0A    
@@ -493,30 +493,138 @@
 e = 
-%22?%22;%0A            try %7B
+caller != null ? caller.getSimpleName() : %22?%22;%0A            Uppercore.logger().info(String.format(%22%5B%25s%5D %25s%22, callerName, message));
 %0A   
@@ -632,95 +632,220 @@
     
+%7D%0A
     
+%7D%0A%0A
     
-Class%3C?%3E caller = Class.forName(new Exception().getStackTrace()%5B1%5D.getClassName
+/**%0A     * Prints a message to the console only if the debug-mode is active.%0A     *%0A     * @param message The message.%0A     */%0A    public static void p(String message) %7B%0A        p0(message, getCaller
 ());
@@ -853,264 +853,439 @@
     
+%7D%0A%0A
     
+/**%0A
      
-   callerName = caller.getSimpleName();
+* Prints a formatted message to the console only if the debug-mode is active.
 %0A     
- 
+*%0A
      
- %7D catch (ClassNotFoundException ignored) %7B%0A            %7D
+* @param format The String format to use.%0A     * @param args   The args that the format takes in.
 %0A     
+*/%0A
     
-   Uppercore.logger().info(String.format(%22%5B%25s%5D %25s%22, callerName, message));%0A        %7D%0A    %7D%0A%0A    public static void loadConfig() %7B
+public static void pf(String format, Object... args) %7B%0A        p0(String.format(format, args), getCaller());%0A    %7D%0A%0A    public static void loadConfig() %7B%0A        // TODO load debug-mode active, currently always true
 %0A   

Add Dbg.pf alias to Debug printf