feat: 添加full debug

Signed-off-by: 502647092 <admin@yumc.pw>
merge/1/MERGE
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);
} }
/** /**