1
0
mirror of https://e.coding.net/circlecloud/YumCore.git synced 2024-11-24 02:08:48 +00:00

feat: Log添加调试方法

Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
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 2016年7月23日 下午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>