mirror of
https://github.com/fankes/termux-app.git
synced 2025-09-06 02:35:19 +08:00
Revert some unneeded changes to Logger done in 679e0de0
Logger was updated to get suppressed exceptions by calling `Throwable[] getSuppressed()` but `printStackTrace()` would already log them, even though shortened stacktrace with `... n more` notation, but this should be enough for debugging since main throwable stacktrace should have enough class line info. Manually logging full suppressed stacktraces would likely trigger `LOGGER_ENTRY_MAX_PAYLOAD` and split the message into multiple log entries and also duplicate the suppressed stacktraces, so best revert this unless ever necessary.
This commit is contained in:
@@ -219,105 +219,54 @@ public class Logger {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static void logStackTraceWithMessage(String tag, String message, Throwable throwable, boolean getSuppressed) {
|
|
||||||
Logger.logErrorExtended(tag, getMessageAndStackTraceString(message, throwable, getSuppressed));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void logStackTraceWithMessage(String tag, String message, Throwable throwable) {
|
public static void logStackTraceWithMessage(String tag, String message, Throwable throwable) {
|
||||||
logStackTraceWithMessage(tag, message, throwable, true);
|
Logger.logErrorExtended(tag, getMessageAndStackTraceString(message, throwable));
|
||||||
}
|
|
||||||
|
|
||||||
public static void logStackTraceWithMessage(String message, Throwable throwable, boolean getSuppressed) {
|
|
||||||
logStackTraceWithMessage(DEFAULT_LOG_TAG, message, throwable, getSuppressed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void logStackTraceWithMessage(String message, Throwable throwable) {
|
public static void logStackTraceWithMessage(String message, Throwable throwable) {
|
||||||
logStackTraceWithMessage(DEFAULT_LOG_TAG, message, throwable, true);
|
logStackTraceWithMessage(DEFAULT_LOG_TAG, message, throwable);
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static void logStackTrace(String tag, Throwable throwable, boolean getSuppressed) {
|
|
||||||
logStackTraceWithMessage(tag, null, throwable, getSuppressed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void logStackTrace(String tag, Throwable throwable) {
|
public static void logStackTrace(String tag, Throwable throwable) {
|
||||||
logStackTraceWithMessage(tag, null, throwable, true);
|
logStackTraceWithMessage(tag, null, throwable);
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static void logStackTrace(Throwable throwable, boolean getSuppressed) {
|
|
||||||
logStackTraceWithMessage(DEFAULT_LOG_TAG, null, throwable, getSuppressed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void logStackTrace(Throwable throwable) {
|
public static void logStackTrace(Throwable throwable) {
|
||||||
logStackTraceWithMessage(DEFAULT_LOG_TAG, null, throwable, true);
|
logStackTraceWithMessage(DEFAULT_LOG_TAG, null, throwable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static void logStackTracesWithMessage(String tag, String message, List<Throwable> throwablesList, boolean getSuppressed) {
|
|
||||||
Logger.logErrorExtended(tag, getMessageAndStackTracesString(message, throwablesList, getSuppressed));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void logStackTracesWithMessage(String tag, String message, List<Throwable> throwablesList) {
|
public static void logStackTracesWithMessage(String tag, String message, List<Throwable> throwablesList) {
|
||||||
Logger.logErrorExtended(tag, getMessageAndStackTracesString(message, throwablesList, true));
|
Logger.logErrorExtended(tag, getMessageAndStackTracesString(message, throwablesList));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static String getMessageAndStackTraceString(String message, Throwable throwable) {
|
public static String getMessageAndStackTraceString(String message, Throwable throwable) {
|
||||||
return getMessageAndStackTraceString(message, throwable, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getMessageAndStackTraceString(String message, Throwable throwable, boolean getSuppressed) {
|
|
||||||
if (message == null && throwable == null)
|
if (message == null && throwable == null)
|
||||||
return null;
|
return null;
|
||||||
else if (message != null && throwable != null)
|
else if (message != null && throwable != null)
|
||||||
return message + ":\n" + getStackTraceString(throwable, getSuppressed);
|
return message + ":\n" + getStackTraceString(throwable);
|
||||||
else if (throwable == null)
|
else if (throwable == null)
|
||||||
return message;
|
return message;
|
||||||
else
|
else
|
||||||
return getStackTraceString(throwable, getSuppressed);
|
return getStackTraceString(throwable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static String getMessageAndStackTracesString(String message, List<Throwable> throwablesList) {
|
public static String getMessageAndStackTracesString(String message, List<Throwable> throwablesList) {
|
||||||
return getMessageAndStackTracesString(message, throwablesList, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getMessageAndStackTracesString(String message, List<Throwable> throwablesList, boolean getSuppressed) {
|
|
||||||
if (message == null && (throwablesList == null || throwablesList.size() == 0))
|
if (message == null && (throwablesList == null || throwablesList.size() == 0))
|
||||||
return null;
|
return null;
|
||||||
else if (message != null && (throwablesList != null && throwablesList.size() != 0))
|
else if (message != null && (throwablesList != null && throwablesList.size() != 0))
|
||||||
return message + ":\n" + getStackTracesString(null, getStackTracesStringArray(throwablesList, getSuppressed));
|
return message + ":\n" + getStackTracesString(null, getStackTracesStringArray(throwablesList));
|
||||||
else if (throwablesList == null || throwablesList.size() == 0)
|
else if (throwablesList == null || throwablesList.size() == 0)
|
||||||
return message;
|
return message;
|
||||||
else
|
else
|
||||||
return getStackTracesString(null, getStackTracesStringArray(throwablesList, getSuppressed));
|
return getStackTracesString(null, getStackTracesStringArray(throwablesList));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static String getStackTraceString(Throwable throwable, boolean getSuppressed) {
|
|
||||||
if (throwable == null) return null;
|
|
||||||
|
|
||||||
StringBuilder stackTraceString = new StringBuilder();
|
|
||||||
stackTraceString.append(getStackTraceString(throwable));
|
|
||||||
|
|
||||||
if (getSuppressed) {
|
|
||||||
Throwable[] suppressedThrowablesArray = throwable.getSuppressed();
|
|
||||||
if (suppressedThrowablesArray != null && suppressedThrowablesArray.length > 0) {
|
|
||||||
for (Throwable suppressedThrowable : suppressedThrowablesArray) {
|
|
||||||
if (suppressedThrowable == null) continue;
|
|
||||||
stackTraceString.append("\n\n").append(getStackTraceString(suppressedThrowable));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return stackTraceString.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getStackTraceString(Throwable throwable) {
|
public static String getStackTraceString(Throwable throwable) {
|
||||||
if (throwable == null) return null;
|
if (throwable == null) return null;
|
||||||
|
|
||||||
@@ -339,25 +288,15 @@ public class Logger {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static String[] getStackTracesStringArray(Throwable throwable, boolean getSuppressed) {
|
|
||||||
return getStackTracesStringArray(Collections.singletonList(throwable), getSuppressed);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String[] getStackTracesStringArray(Throwable throwable) {
|
public static String[] getStackTracesStringArray(Throwable throwable) {
|
||||||
return getStackTracesStringArray(Collections.singletonList(throwable), true);
|
return getStackTracesStringArray(Collections.singletonList(throwable));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String[] getStackTracesStringArray(List<Throwable> throwablesList) {
|
public static String[] getStackTracesStringArray(List<Throwable> throwablesList) {
|
||||||
return getStackTracesStringArray(throwablesList, true);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String[] getStackTracesStringArray(List<Throwable> throwablesList, boolean getSuppressed) {
|
|
||||||
if (throwablesList == null) return null;
|
if (throwablesList == null) return null;
|
||||||
|
|
||||||
final String[] stackTraceStringArray = new String[throwablesList.size()];
|
final String[] stackTraceStringArray = new String[throwablesList.size()];
|
||||||
for (int i = 0; i < throwablesList.size(); i++) {
|
for (int i = 0; i < throwablesList.size(); i++) {
|
||||||
stackTraceStringArray[i] = getStackTraceString(throwablesList.get(i), getSuppressed);
|
stackTraceStringArray[i] = getStackTraceString(throwablesList.get(i));
|
||||||
}
|
}
|
||||||
return stackTraceStringArray;
|
return stackTraceStringArray;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user