feat: Log添加调试方法

Signed-off-by: 502647092 <admin@yumc.pw>
merge/1/MERGE
502647092 2016-08-24 19:22:49 +08:00
parent c82a837bc4
commit c1a8830eca
2 changed files with 32 additions and 3 deletions

View File

@ -1,11 +1,12 @@
package pw.yumc.YumCore;
import org.bukkit.plugin.java.JavaPlugin;
/**
* YumCore
*
*
* @since 2016723 1:03:41
* @author
*/
public class YumCore {
public class YumCore extends JavaPlugin {
}

View File

@ -1,5 +1,6 @@
package pw.yumc.YumCore.bukkit;
import java.io.File;
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -14,6 +15,7 @@ import org.bukkit.command.CommandSender;
* @author
*/
public class Log {
private static boolean debug = new File("plugins/YumCore/debug").exists();
private static Logger logger = P.instance.getLogger();
private static String prefix = String.format("§6[§b%s§6]§r ", P.instance.getName());
private static CommandSender console = Bukkit.getConsoleSender();
@ -47,6 +49,32 @@ public class Log {
}
}
/**
*
*
* @param msg
*
*/
public static void debug(final String msg) {
if (debug) {
logger.info("[DEBUG] " + msg);
}
}
/**
*
*
* @param msg
*
* @param object
*
*/
public static void debug(final String msg, final Object... object) {
if (debug) {
logger.log(Level.SEVERE, "[DEBUG] " + msg, object);
}
}
/**
* Log an INFO message.
* <p>