1
0
mirror of https://e.coding.net/circlecloud/YumCore.git synced 2024-11-22 01:48:50 +00:00

feat: 添加full debug

Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
502647092 2017-02-13 20:28:07 +08:00
parent 087746aa08
commit 835843f06a
2 changed files with 53 additions and 1 deletions

View File

@ -20,6 +20,7 @@ import pw.yumc.YumCore.annotation.NotProguard;
*/ */
@NotProguard @NotProguard
public class Log { 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 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 boolean debug = globalDebug || P.getDescription().getVersion().contains("DEV");
private static Logger logger = P.instance.getLogger(); 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 获得插件前缀 * @return 获得插件前缀
*/ */

View File

@ -112,7 +112,7 @@ public abstract class AbstractInjectConfig {
Log.w("字段 %s 默认类型为 %s 但解析后为 %s 可能存在转换错误!", field.getName(), type.getName(), value.getClass().getName()); Log.w("字段 %s 默认类型为 %s 但解析后为 %s 可能存在转换错误!", field.getName(), type.getName(), value.getClass().getName());
} }
field.set(this, value); field.set(this, value);
Log.d("设置字段 %s 为 %s ", field.getName(), value); Log.fd("设置字段 %s 为 %s ", field.getName(), value);
} }
/** /**