From 924c1f80ec0d17a3bdc07a0fb2015e44c49162e4 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Thu, 24 Aug 2023 23:45:10 +0200 Subject: [PATCH] fix: print stack trace when a patch failed --- src/main/kotlin/app/revanced/cli/command/PatchCommand.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/app/revanced/cli/command/PatchCommand.kt b/src/main/kotlin/app/revanced/cli/command/PatchCommand.kt index 54d8986f..1df5d81c 100644 --- a/src/main/kotlin/app/revanced/cli/command/PatchCommand.kt +++ b/src/main/kotlin/app/revanced/cli/command/PatchCommand.kt @@ -19,6 +19,8 @@ import kotlinx.coroutines.runBlocking import picocli.CommandLine import picocli.CommandLine.Help.Visibility.ALWAYS import java.io.File +import java.io.PrintWriter +import java.io.StringWriter import java.util.logging.Logger @@ -174,7 +176,10 @@ internal object PatchCommand : Runnable { runBlocking { apply(false).collect { patchResult -> patchResult.exception?.let { - logger.severe("${patchResult.patchName} failed:\n${patchResult.exception}") + StringWriter().use { writer -> + it.printStackTrace(PrintWriter(writer)) + logger.severe("${patchResult.patchName} failed: $writer") + } } ?: logger.info("${patchResult.patchName} succeeded") } }