[core] Refine module log output
* Add E/I to indicate error or information, while we are at it, slightly change output format.
This commit is contained in:
parent
9b081dac37
commit
40fcde9ce0
|
|
@ -134,7 +134,7 @@ public final class XposedBridge {
|
|||
*/
|
||||
public synchronized static void log(String text) {
|
||||
Log.i(TAG, text);
|
||||
ModuleLogger.log(text);
|
||||
ModuleLogger.log(text, false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -148,7 +148,7 @@ public final class XposedBridge {
|
|||
public synchronized static void log(Throwable t) {
|
||||
String logStr = Log.getStackTraceString(t);
|
||||
Log.e(TAG, logStr);
|
||||
ModuleLogger.log(logStr);
|
||||
ModuleLogger.log(logStr, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -44,23 +44,25 @@ public class ModuleLogger {
|
|||
|
||||
private static native void nativeLog(int fd, String logStr);
|
||||
|
||||
public static void log(String str) {
|
||||
public static void log(String str, boolean isThrowable) {
|
||||
if (fd == -1) {
|
||||
Utils.logE("Logger is not initialized");
|
||||
return;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String processName = ActivityThread.currentProcessName();
|
||||
|
||||
sb.append(logDateFormat.format(new Date()));
|
||||
sb.append(' ');
|
||||
sb.append(isThrowable ? "E" : "I");
|
||||
sb.append('/');
|
||||
sb.append(processName == null ? "?" : processName);
|
||||
sb.append('(');
|
||||
sb.append(Process.myPid());
|
||||
sb.append('-');
|
||||
sb.append(Process.myTid());
|
||||
sb.append('/');
|
||||
String processName = ActivityThread.currentProcessName();
|
||||
if (processName == null) sb.append("?");
|
||||
else sb.append(processName);
|
||||
sb.append(' ');
|
||||
sb.append("LSPosedBridge: ");
|
||||
sb.append(')');
|
||||
sb.append(": ");
|
||||
sb.append(str);
|
||||
sb.append('\n');
|
||||
nativeLog(fd, sb.toString());
|
||||
|
|
|
|||
Loading…
Reference in New Issue