feat(youtube/debugging): print stack traces

This commit is contained in:
oSumAtrIX 2022-12-05 06:34:33 +01:00
parent 080e22b1bf
commit a9d24872a8
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4
2 changed files with 15 additions and 1 deletions

View File

@ -110,6 +110,8 @@ public enum SettingsEnum {
// ReVanced settings
DEBUG("revanced_debug_enabled", false, ReturnType.BOOLEAN),
DEBUG_STACKTRACE("revanced_debug_stacktrace_enabled", false, ReturnType.BOOLEAN),
USE_DARK_THEME("app_theme_dark", false, ReturnType.BOOLEAN),
// RYD settings

View File

@ -2,6 +2,9 @@ package app.revanced.integrations.utils;
import android.util.Log;
import java.io.PrintWriter;
import java.io.StringWriter;
import app.revanced.integrations.settings.SettingsEnum;
public class LogHelper {
@ -50,7 +53,16 @@ public class LogHelper {
*/
public static void printDebug(LogMessage message) {
if (SettingsEnum.DEBUG.getBoolean()) {
Log.d("revanced: " + message.findOuterClassSimpleName(), message.buildMessageString());
var log = new StringBuilder(message.buildMessageString());
if (SettingsEnum.DEBUG_STACKTRACE.getBoolean()) {
var sw = new StringWriter();
new Throwable().printStackTrace(new PrintWriter(sw));
log.append(String.format("\n%s", sw));
}
Log.d("revanced: " + message.findOuterClassSimpleName(), log.toString());
}
}