From 3c11f79b2028b5eb4a3a1dd22f22405dc5b3b9fd Mon Sep 17 00:00:00 2001 From: agnostic-apollo Date: Sat, 21 Aug 2021 03:48:32 +0500 Subject: [PATCH] Changed: Use extended version of Logger functions for logging execution commands --- app/src/main/java/com/termux/app/RunCommandService.java | 2 +- app/src/main/java/com/termux/app/TermuxService.java | 4 ++-- .../main/java/com/termux/shared/file/TermuxFileUtils.java | 4 ++-- .../main/java/com/termux/shared/shell/TermuxSession.java | 2 +- .../src/main/java/com/termux/shared/shell/TermuxTask.java | 2 +- .../main/java/com/termux/shared/termux/TermuxUtils.java | 8 ++++---- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/com/termux/app/RunCommandService.java b/app/src/main/java/com/termux/app/RunCommandService.java index 0c8903ba92..bc4d64512a 100644 --- a/app/src/main/java/com/termux/app/RunCommandService.java +++ b/app/src/main/java/com/termux/app/RunCommandService.java @@ -189,7 +189,7 @@ public int onStartCommand(Intent intent, int flags, int startId) { executionCommand.executableUri = new Uri.Builder().scheme(TERMUX_SERVICE.URI_SCHEME_SERVICE_EXECUTE).path(executionCommand.executable).build(); - Logger.logVerbose(LOG_TAG, executionCommand.toString()); + Logger.logVerboseExtended(LOG_TAG, executionCommand.toString()); // Create execution intent with the action TERMUX_SERVICE#ACTION_SERVICE_EXECUTE to be sent to the TERMUX_SERVICE Intent execIntent = new Intent(TERMUX_SERVICE.ACTION_SERVICE_EXECUTE, executionCommand.executableUri); diff --git a/app/src/main/java/com/termux/app/TermuxService.java b/app/src/main/java/com/termux/app/TermuxService.java index bb3f38c80d..52cba673ad 100644 --- a/app/src/main/java/com/termux/app/TermuxService.java +++ b/app/src/main/java/com/termux/app/TermuxService.java @@ -427,7 +427,7 @@ public synchronized TermuxTask createTermuxTask(ExecutionCommand executionComman } if (Logger.getLogLevel() >= Logger.LOG_LEVEL_VERBOSE) - Logger.logVerbose(LOG_TAG, executionCommand.toString()); + Logger.logVerboseExtended(LOG_TAG, executionCommand.toString()); TermuxTask newTermuxTask = TermuxTask.execute(this, executionCommand, this, new TermuxShellEnvironmentClient(), false); if (newTermuxTask == null) { @@ -519,7 +519,7 @@ public synchronized TermuxSession createTermuxSession(ExecutionCommand execution } if (Logger.getLogLevel() >= Logger.LOG_LEVEL_VERBOSE) - Logger.logVerbose(LOG_TAG, executionCommand.toString()); + Logger.logVerboseExtended(LOG_TAG, executionCommand.toString()); // If the execution command was started for a plugin, only then will the stdout be set // Otherwise if command was manually started by the user like by adding a new terminal session, diff --git a/termux-shared/src/main/java/com/termux/shared/file/TermuxFileUtils.java b/termux-shared/src/main/java/com/termux/shared/file/TermuxFileUtils.java index 41c76b875d..f7df0b9d19 100644 --- a/termux-shared/src/main/java/com/termux/shared/file/TermuxFileUtils.java +++ b/termux-shared/src/main/java/com/termux/shared/file/TermuxFileUtils.java @@ -264,7 +264,7 @@ public static String getTermuxFilesDirStatMarkdownString(@NonNull final Context executionCommand.backgroundCustomLogLevel = Logger.LOG_LEVEL_OFF; TermuxTask termuxTask = TermuxTask.execute(context, executionCommand, null, new TermuxShellEnvironmentClient(), true); if (termuxTask == null || !executionCommand.isSuccessful()) { - Logger.logError(LOG_TAG, executionCommand.toString()); + Logger.logErrorExtended(LOG_TAG, executionCommand.toString()); return null; } @@ -275,7 +275,7 @@ public static String getTermuxFilesDirStatMarkdownString(@NonNull final Context boolean stderrSet = !executionCommand.resultData.stderr.toString().isEmpty(); if (executionCommand.resultData.exitCode != 0 || stderrSet) { - Logger.logError(LOG_TAG, executionCommand.toString()); + Logger.logErrorExtended(LOG_TAG, executionCommand.toString()); if (stderrSet) statOutput.append("\n").append(executionCommand.resultData.stderr.toString()); statOutput.append("\n").append("exit code: ").append(executionCommand.resultData.exitCode.toString()); diff --git a/termux-shared/src/main/java/com/termux/shared/shell/TermuxSession.java b/termux-shared/src/main/java/com/termux/shared/shell/TermuxSession.java index 5d46733062..b69e36daeb 100644 --- a/termux-shared/src/main/java/com/termux/shared/shell/TermuxSession.java +++ b/termux-shared/src/main/java/com/termux/shared/shell/TermuxSession.java @@ -125,7 +125,7 @@ public static TermuxSession execute(@NonNull final Context context, @NonNull Exe return null; } - Logger.logDebug(LOG_TAG, executionCommand.toString()); + Logger.logDebugExtended(LOG_TAG, executionCommand.toString()); Logger.logDebug(LOG_TAG, "Running \"" + executionCommand.getCommandIdAndLabelLogString() + "\" TermuxSession"); TerminalSession terminalSession = new TerminalSession(executionCommand.executable, executionCommand.workingDirectory, executionCommand.arguments, environment, executionCommand.terminalTranscriptRows, terminalSessionClient); diff --git a/termux-shared/src/main/java/com/termux/shared/shell/TermuxTask.java b/termux-shared/src/main/java/com/termux/shared/shell/TermuxTask.java index 8b75be41a3..8f8974ac5d 100644 --- a/termux-shared/src/main/java/com/termux/shared/shell/TermuxTask.java +++ b/termux-shared/src/main/java/com/termux/shared/shell/TermuxTask.java @@ -83,7 +83,7 @@ public static TermuxTask execute(@NonNull final Context context, @NonNull Execut // No need to log stdin if logging is disabled, like for app internal scripts int customLogLevel = Logger.isLogLevelValid(executionCommand.backgroundCustomLogLevel) ? executionCommand.backgroundCustomLogLevel: Logger.LOG_LEVEL_VERBOSE; - Logger.logDebug(LOG_TAG, ExecutionCommand.getExecutionInputLogString(executionCommand, true, customLogLevel >= Logger.getLogLevel())); + Logger.logDebugExtended(LOG_TAG, ExecutionCommand.getExecutionInputLogString(executionCommand, true, customLogLevel >= Logger.getLogLevel())); String taskName = ShellUtils.getExecutableBasename(executionCommand.executable); diff --git a/termux-shared/src/main/java/com/termux/shared/termux/TermuxUtils.java b/termux-shared/src/main/java/com/termux/shared/termux/TermuxUtils.java index 5f836ce746..d401061ad5 100644 --- a/termux-shared/src/main/java/com/termux/shared/termux/TermuxUtils.java +++ b/termux-shared/src/main/java/com/termux/shared/termux/TermuxUtils.java @@ -345,12 +345,12 @@ public static String geAPTInfoMarkdownString(@NonNull final Context context) { executionCommand.backgroundCustomLogLevel = Logger.LOG_LEVEL_OFF; TermuxTask termuxTask = TermuxTask.execute(context, executionCommand, null, new TermuxShellEnvironmentClient(), true); if (termuxTask == null || !executionCommand.isSuccessful() || executionCommand.resultData.exitCode != 0) { - Logger.logError(LOG_TAG, executionCommand.toString()); + Logger.logErrorExtended(LOG_TAG, executionCommand.toString()); return null; } if (!executionCommand.resultData.stderr.toString().isEmpty()) - Logger.logError(LOG_TAG, executionCommand.toString()); + Logger.logErrorExtended(LOG_TAG, executionCommand.toString()); StringBuilder markdownString = new StringBuilder(); @@ -403,7 +403,7 @@ public static String getLogcatDumpMarkdownString(@NonNull final Context context) executionCommand.backgroundCustomLogLevel = Logger.LOG_LEVEL_OFF; TermuxTask termuxTask = TermuxTask.execute(context, executionCommand, null, new TermuxShellEnvironmentClient(), true); if (termuxTask == null || !executionCommand.isSuccessful()) { - Logger.logError(LOG_TAG, executionCommand.toString()); + Logger.logErrorExtended(LOG_TAG, executionCommand.toString()); return null; } @@ -414,7 +414,7 @@ public static String getLogcatDumpMarkdownString(@NonNull final Context context) boolean stderrSet = !executionCommand.resultData.stderr.toString().isEmpty(); if (executionCommand.resultData.exitCode != 0 || stderrSet) { - Logger.logError(LOG_TAG, executionCommand.toString()); + Logger.logErrorExtended(LOG_TAG, executionCommand.toString()); if (stderrSet) logcatOutput.append("\n").append(executionCommand.resultData.stderr.toString()); logcatOutput.append("\n").append("exit code: ").append(executionCommand.resultData.exitCode.toString());