|
|
@@ -20,6 +20,14 @@ import com.jfinal.log.Log;
|
|
|
|
|
|
/**
|
|
|
* LogKit.
|
|
|
+ *
|
|
|
+ * 注意:LogKit 是专门针对 jfinal 内部使用来设计的,不建议大家在项目中使用 LogKit
|
|
|
+ * 因为 LogKit 输出不带 Throwable 参数的日志时,将不会记录日志发生地点的类信息
|
|
|
+ * 与方法信息,LogKit 可以做成通过反射机制来输出类信息与方法信息,但会损失性能
|
|
|
+ *
|
|
|
+ * 用户自己的代码中应该使用如下形式来做日志:
|
|
|
+ * Log log = Log.getLog(...);
|
|
|
+ * log.error(...);
|
|
|
*/
|
|
|
public class LogKit {
|
|
|
|
|
|
@@ -43,6 +51,18 @@ public class LogKit {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ public static void trace(String message) {
|
|
|
+ Holder.log.trace(message);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void trace(String message, Throwable t) {
|
|
|
+ Holder.log.trace(message, t);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void trace(String format, Object... args) {
|
|
|
+ Holder.log.trace(format, args);
|
|
|
+ }
|
|
|
+
|
|
|
public static void debug(String message) {
|
|
|
Holder.log.debug(message);
|
|
|
}
|
|
|
@@ -51,6 +71,10 @@ public class LogKit {
|
|
|
Holder.log.debug(message, t);
|
|
|
}
|
|
|
|
|
|
+ public static void debug(String format, Object... args) {
|
|
|
+ Holder.log.debug(format, args);
|
|
|
+ }
|
|
|
+
|
|
|
public static void info(String message) {
|
|
|
Holder.log.info(message);
|
|
|
}
|
|
|
@@ -59,6 +83,10 @@ public class LogKit {
|
|
|
Holder.log.info(message, t);
|
|
|
}
|
|
|
|
|
|
+ public static void info(String format, Object... args) {
|
|
|
+ Holder.log.info(format, args);
|
|
|
+ }
|
|
|
+
|
|
|
public static void warn(String message) {
|
|
|
Holder.log.warn(message);
|
|
|
}
|
|
|
@@ -67,6 +95,10 @@ public class LogKit {
|
|
|
Holder.log.warn(message, t);
|
|
|
}
|
|
|
|
|
|
+ public static void warn(String format, Object... args) {
|
|
|
+ Holder.log.warn(format, args);
|
|
|
+ }
|
|
|
+
|
|
|
public static void error(String message) {
|
|
|
Holder.log.error(message);
|
|
|
}
|
|
|
@@ -75,6 +107,10 @@ public class LogKit {
|
|
|
Holder.log.error(message, t);
|
|
|
}
|
|
|
|
|
|
+ public static void error(String format, Object... args) {
|
|
|
+ Holder.log.error(format, args);
|
|
|
+ }
|
|
|
+
|
|
|
public static void fatal(String message) {
|
|
|
Holder.log.fatal(message);
|
|
|
}
|
|
|
@@ -83,6 +119,14 @@ public class LogKit {
|
|
|
Holder.log.fatal(message, t);
|
|
|
}
|
|
|
|
|
|
+ public static void fatal(String format, Object... args) {
|
|
|
+ Holder.log.fatal(format, args);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static boolean isTraceEnabled() {
|
|
|
+ return Holder.log.isTraceEnabled();
|
|
|
+ }
|
|
|
+
|
|
|
public static boolean isDebugEnabled() {
|
|
|
return Holder.log.isDebugEnabled();
|
|
|
}
|