|
|
@@ -3,9 +3,11 @@ package com.benyanyi.loglib;
|
|
|
import android.annotation.SuppressLint;
|
|
|
import android.app.Application;
|
|
|
import android.content.pm.ApplicationInfo;
|
|
|
-import android.support.annotation.Nullable;
|
|
|
import android.text.TextUtils;
|
|
|
|
|
|
+import androidx.annotation.NonNull;
|
|
|
+import androidx.annotation.Nullable;
|
|
|
+
|
|
|
import java.io.File;
|
|
|
import java.io.PrintWriter;
|
|
|
import java.io.StringWriter;
|
|
|
@@ -73,7 +75,7 @@ public final class Jlog {
|
|
|
printLog(V, null, msg);
|
|
|
}
|
|
|
|
|
|
- public static void v(String tag, Object... objects) {
|
|
|
+ public static void v(Object tag, @NonNull Object... objects) {
|
|
|
printLog(V, tag, objects);
|
|
|
}
|
|
|
|
|
|
@@ -85,7 +87,7 @@ public final class Jlog {
|
|
|
printLog(D, null, msg);
|
|
|
}
|
|
|
|
|
|
- public static void d(String tag, Object... objects) {
|
|
|
+ public static void d(Object tag, Object... objects) {
|
|
|
printLog(D, tag, objects);
|
|
|
}
|
|
|
|
|
|
@@ -97,7 +99,7 @@ public final class Jlog {
|
|
|
printLog(I, null, msg);
|
|
|
}
|
|
|
|
|
|
- public static void i(String tag, Object... objects) {
|
|
|
+ public static void i(Object tag, Object... objects) {
|
|
|
printLog(I, tag, objects);
|
|
|
}
|
|
|
|
|
|
@@ -109,7 +111,7 @@ public final class Jlog {
|
|
|
printLog(W, null, msg);
|
|
|
}
|
|
|
|
|
|
- public static void w(String tag, Object... objects) {
|
|
|
+ public static void w(Object tag, Object... objects) {
|
|
|
printLog(W, tag, objects);
|
|
|
}
|
|
|
|
|
|
@@ -121,7 +123,7 @@ public final class Jlog {
|
|
|
printLog(E, null, msg);
|
|
|
}
|
|
|
|
|
|
- public static void e(String tag, Object... objects) {
|
|
|
+ public static void e(Object tag, Object... objects) {
|
|
|
printLog(E, tag, objects);
|
|
|
}
|
|
|
|
|
|
@@ -133,23 +135,23 @@ public final class Jlog {
|
|
|
printLog(A, null, msg);
|
|
|
}
|
|
|
|
|
|
- public static void a(String tag, Object... objects) {
|
|
|
+ public static void a(Object tag, Object... objects) {
|
|
|
printLog(A, tag, objects);
|
|
|
}
|
|
|
|
|
|
- public static void json(String jsonFormat) {
|
|
|
+ public static void json(Object jsonFormat) {
|
|
|
printLog(JSON, null, jsonFormat);
|
|
|
}
|
|
|
|
|
|
- public static void json(String tag, String jsonFormat) {
|
|
|
+ public static void json(Object tag, String jsonFormat) {
|
|
|
printLog(JSON, tag, jsonFormat);
|
|
|
}
|
|
|
|
|
|
- public static void xml(String xml) {
|
|
|
+ public static void xml(Object xml) {
|
|
|
printLog(XML, null, xml);
|
|
|
}
|
|
|
|
|
|
- public static void xml(String tag, String xml) {
|
|
|
+ public static void xml(Object tag, String xml) {
|
|
|
printLog(XML, tag, xml);
|
|
|
}
|
|
|
|
|
|
@@ -157,11 +159,11 @@ public final class Jlog {
|
|
|
printFile(null, targetDirectory, null, msg);
|
|
|
}
|
|
|
|
|
|
- public static void file(String tag, File targetDirectory, Object msg) {
|
|
|
+ public static void file(Object tag, File targetDirectory, Object msg) {
|
|
|
printFile(tag, targetDirectory, null, msg);
|
|
|
}
|
|
|
|
|
|
- public static void file(String tag, File targetDirectory, String fileName, Object msg) {
|
|
|
+ public static void file(Object tag, File targetDirectory, String fileName, Object msg) {
|
|
|
printFile(tag, targetDirectory, fileName, msg);
|
|
|
}
|
|
|
|
|
|
@@ -173,7 +175,7 @@ public final class Jlog {
|
|
|
printDebug(null, msg);
|
|
|
}
|
|
|
|
|
|
- public static void debug(String tag, Object... objects) {
|
|
|
+ public static void debug(Object tag, Object... objects) {
|
|
|
printDebug(tag, objects);
|
|
|
}
|
|
|
|
|
|
@@ -213,7 +215,7 @@ public final class Jlog {
|
|
|
BaseLog.printDefault(D, tag, headString + msg);
|
|
|
}
|
|
|
|
|
|
- private static void printLog(int type, String tagStr, Object... objects) {
|
|
|
+ private static void printLog(int type, Object tagStr, Object... objects) {
|
|
|
|
|
|
if (!IS_SHOW_LOG) {
|
|
|
return;
|
|
|
@@ -246,7 +248,7 @@ public final class Jlog {
|
|
|
|
|
|
}
|
|
|
|
|
|
- private static void printDebug(String tagStr, Object... objects) {
|
|
|
+ private static void printDebug(Object tagStr, Object... objects) {
|
|
|
String[] contents = wrapperContent(STACK_TRACE_INDEX_5, tagStr, objects);
|
|
|
String tag = contents[0];
|
|
|
String msg = contents[1];
|
|
|
@@ -255,7 +257,7 @@ public final class Jlog {
|
|
|
}
|
|
|
|
|
|
|
|
|
- private static void printFile(String tagStr, File targetDirectory, String fileName, Object objectMsg) {
|
|
|
+ private static void printFile(Object tagStr, File targetDirectory, String fileName, Object objectMsg) {
|
|
|
|
|
|
if (!IS_SHOW_LOG) {
|
|
|
return;
|
|
|
@@ -271,7 +273,7 @@ public final class Jlog {
|
|
|
FileLog.printFile(tag, targetDirectory, fileName, headString, msg);
|
|
|
}
|
|
|
|
|
|
- private static String[] wrapperContent(int stackTraceIndex, String tagStr, Object... objects) {
|
|
|
+ private static String[] wrapperContent(int stackTraceIndex, Object tagStr, Object... objects) {
|
|
|
|
|
|
if (FILE_TYPE == FileType.KOTLIN) {
|
|
|
SUFFIX = ".kt";
|
|
|
@@ -299,7 +301,7 @@ public final class Jlog {
|
|
|
lineNumber = 0;
|
|
|
}
|
|
|
|
|
|
- String tag = (tagStr == null ? className : tagStr);
|
|
|
+ String tag = (tagStr == null ? className : tagStr).toString();
|
|
|
|
|
|
if (mIsGlobalTagEmpty && TextUtils.isEmpty(tag)) {
|
|
|
tag = TAG_DEFAULT;
|