From 835843f06aab547edd04d611a6bc80b2e0ed40a9 Mon Sep 17 00:00:00 2001 From: 502647092 Date: Mon, 13 Feb 2017 20:28:07 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0full=20debug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 502647092 --- src/main/java/pw/yumc/YumCore/bukkit/Log.java | 52 +++++++++++++++++++ .../config/inject/AbstractInjectConfig.java | 2 +- 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/src/main/java/pw/yumc/YumCore/bukkit/Log.java b/src/main/java/pw/yumc/YumCore/bukkit/Log.java index 5f321cc..853a1bb 100644 --- a/src/main/java/pw/yumc/YumCore/bukkit/Log.java +++ b/src/main/java/pw/yumc/YumCore/bukkit/Log.java @@ -20,6 +20,7 @@ import pw.yumc.YumCore.annotation.NotProguard; */ @NotProguard public class Log { + private static boolean fullDebug = new File(String.format("plugins%1$sYumCore%1$sfulldebug", File.separatorChar)).exists(); private static boolean globalDebug = new File(String.format("plugins%1$sYumCore%1$sdebug", File.separatorChar)).exists(); private static boolean debug = globalDebug || P.getDescription().getVersion().contains("DEV"); private static Logger logger = P.instance.getLogger(); @@ -131,6 +132,57 @@ public class Log { } } + /** + * 完全调试消息 + * + * @param msg + * 消息 + */ + public static void fd(String msg) { + if (fullDebug) { + logger.info("[DEBUG] " + msg); + } + } + + /** + * 完全调试消息 + * + * @param msg + * 消息 + * @param object + * 参数 + */ + public static void fd(String msg, Object... object) { + fd(String.format(msg, object)); + } + + /** + * 完全调试消息 + * + * @param e + * 异常 + */ + public static void fd(Throwable e) { + if (fullDebug) { + e.printStackTrace(); + } + } + + /** + * 完全调试消息 + * + * @param msg + * 消息 + * @param e + * 异常 + */ + public static void fd(String msg, Throwable e) { + if (fullDebug) { + logger.info("[DEBUG] " + msg); + e.printStackTrace(); + } + } + /** * @return 获得插件前缀 */ diff --git a/src/main/java/pw/yumc/YumCore/config/inject/AbstractInjectConfig.java b/src/main/java/pw/yumc/YumCore/config/inject/AbstractInjectConfig.java index 9ad7f35..812561d 100644 --- a/src/main/java/pw/yumc/YumCore/config/inject/AbstractInjectConfig.java +++ b/src/main/java/pw/yumc/YumCore/config/inject/AbstractInjectConfig.java @@ -112,7 +112,7 @@ public abstract class AbstractInjectConfig { Log.w("字段 %s 默认类型为 %s 但解析后为 %s 可能存在转换错误!", field.getName(), type.getName(), value.getClass().getName()); } field.set(this, value); - Log.d("设置字段 %s 为 %s ", field.getName(), value); + Log.fd("设置字段 %s 为 %s ", field.getName(), value); } /**