mirror of
https://github.com/revanced/revanced-integrations.git
synced 2025-02-09 10:36:47 +01:00
feat(youtube/debugging): print stack traces
This commit is contained in:
parent
080e22b1bf
commit
a9d24872a8
@ -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
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user