mirror of
https://github.com/fankes/termux-app.git
synced 2025-09-06 10:45:23 +08:00
Changed: Use extended version of Logger functions for logging execution commands
This commit is contained in:
@@ -189,7 +189,7 @@ public class RunCommandService extends Service {
|
|||||||
|
|
||||||
executionCommand.executableUri = new Uri.Builder().scheme(TERMUX_SERVICE.URI_SCHEME_SERVICE_EXECUTE).path(executionCommand.executable).build();
|
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
|
// 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);
|
Intent execIntent = new Intent(TERMUX_SERVICE.ACTION_SERVICE_EXECUTE, executionCommand.executableUri);
|
||||||
|
@@ -427,7 +427,7 @@ public final class TermuxService extends Service implements TermuxTask.TermuxTas
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Logger.getLogLevel() >= Logger.LOG_LEVEL_VERBOSE)
|
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);
|
TermuxTask newTermuxTask = TermuxTask.execute(this, executionCommand, this, new TermuxShellEnvironmentClient(), false);
|
||||||
if (newTermuxTask == null) {
|
if (newTermuxTask == null) {
|
||||||
@@ -519,7 +519,7 @@ public final class TermuxService extends Service implements TermuxTask.TermuxTas
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Logger.getLogLevel() >= Logger.LOG_LEVEL_VERBOSE)
|
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
|
// 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,
|
// Otherwise if command was manually started by the user like by adding a new terminal session,
|
||||||
|
@@ -264,7 +264,7 @@ public class TermuxFileUtils {
|
|||||||
executionCommand.backgroundCustomLogLevel = Logger.LOG_LEVEL_OFF;
|
executionCommand.backgroundCustomLogLevel = Logger.LOG_LEVEL_OFF;
|
||||||
TermuxTask termuxTask = TermuxTask.execute(context, executionCommand, null, new TermuxShellEnvironmentClient(), true);
|
TermuxTask termuxTask = TermuxTask.execute(context, executionCommand, null, new TermuxShellEnvironmentClient(), true);
|
||||||
if (termuxTask == null || !executionCommand.isSuccessful()) {
|
if (termuxTask == null || !executionCommand.isSuccessful()) {
|
||||||
Logger.logError(LOG_TAG, executionCommand.toString());
|
Logger.logErrorExtended(LOG_TAG, executionCommand.toString());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -275,7 +275,7 @@ public class TermuxFileUtils {
|
|||||||
|
|
||||||
boolean stderrSet = !executionCommand.resultData.stderr.toString().isEmpty();
|
boolean stderrSet = !executionCommand.resultData.stderr.toString().isEmpty();
|
||||||
if (executionCommand.resultData.exitCode != 0 || stderrSet) {
|
if (executionCommand.resultData.exitCode != 0 || stderrSet) {
|
||||||
Logger.logError(LOG_TAG, executionCommand.toString());
|
Logger.logErrorExtended(LOG_TAG, executionCommand.toString());
|
||||||
if (stderrSet)
|
if (stderrSet)
|
||||||
statOutput.append("\n").append(executionCommand.resultData.stderr.toString());
|
statOutput.append("\n").append(executionCommand.resultData.stderr.toString());
|
||||||
statOutput.append("\n").append("exit code: ").append(executionCommand.resultData.exitCode.toString());
|
statOutput.append("\n").append("exit code: ").append(executionCommand.resultData.exitCode.toString());
|
||||||
|
@@ -125,7 +125,7 @@ public class TermuxSession {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.logDebug(LOG_TAG, executionCommand.toString());
|
Logger.logDebugExtended(LOG_TAG, executionCommand.toString());
|
||||||
|
|
||||||
Logger.logDebug(LOG_TAG, "Running \"" + executionCommand.getCommandIdAndLabelLogString() + "\" TermuxSession");
|
Logger.logDebug(LOG_TAG, "Running \"" + executionCommand.getCommandIdAndLabelLogString() + "\" TermuxSession");
|
||||||
TerminalSession terminalSession = new TerminalSession(executionCommand.executable, executionCommand.workingDirectory, executionCommand.arguments, environment, executionCommand.terminalTranscriptRows, terminalSessionClient);
|
TerminalSession terminalSession = new TerminalSession(executionCommand.executable, executionCommand.workingDirectory, executionCommand.arguments, environment, executionCommand.terminalTranscriptRows, terminalSessionClient);
|
||||||
|
@@ -83,7 +83,7 @@ public final class TermuxTask {
|
|||||||
|
|
||||||
// No need to log stdin if logging is disabled, like for app internal scripts
|
// 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;
|
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);
|
String taskName = ShellUtils.getExecutableBasename(executionCommand.executable);
|
||||||
|
|
||||||
|
@@ -345,12 +345,12 @@ public class TermuxUtils {
|
|||||||
executionCommand.backgroundCustomLogLevel = Logger.LOG_LEVEL_OFF;
|
executionCommand.backgroundCustomLogLevel = Logger.LOG_LEVEL_OFF;
|
||||||
TermuxTask termuxTask = TermuxTask.execute(context, executionCommand, null, new TermuxShellEnvironmentClient(), true);
|
TermuxTask termuxTask = TermuxTask.execute(context, executionCommand, null, new TermuxShellEnvironmentClient(), true);
|
||||||
if (termuxTask == null || !executionCommand.isSuccessful() || executionCommand.resultData.exitCode != 0) {
|
if (termuxTask == null || !executionCommand.isSuccessful() || executionCommand.resultData.exitCode != 0) {
|
||||||
Logger.logError(LOG_TAG, executionCommand.toString());
|
Logger.logErrorExtended(LOG_TAG, executionCommand.toString());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!executionCommand.resultData.stderr.toString().isEmpty())
|
if (!executionCommand.resultData.stderr.toString().isEmpty())
|
||||||
Logger.logError(LOG_TAG, executionCommand.toString());
|
Logger.logErrorExtended(LOG_TAG, executionCommand.toString());
|
||||||
|
|
||||||
StringBuilder markdownString = new StringBuilder();
|
StringBuilder markdownString = new StringBuilder();
|
||||||
|
|
||||||
@@ -403,7 +403,7 @@ public class TermuxUtils {
|
|||||||
executionCommand.backgroundCustomLogLevel = Logger.LOG_LEVEL_OFF;
|
executionCommand.backgroundCustomLogLevel = Logger.LOG_LEVEL_OFF;
|
||||||
TermuxTask termuxTask = TermuxTask.execute(context, executionCommand, null, new TermuxShellEnvironmentClient(), true);
|
TermuxTask termuxTask = TermuxTask.execute(context, executionCommand, null, new TermuxShellEnvironmentClient(), true);
|
||||||
if (termuxTask == null || !executionCommand.isSuccessful()) {
|
if (termuxTask == null || !executionCommand.isSuccessful()) {
|
||||||
Logger.logError(LOG_TAG, executionCommand.toString());
|
Logger.logErrorExtended(LOG_TAG, executionCommand.toString());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -414,7 +414,7 @@ public class TermuxUtils {
|
|||||||
|
|
||||||
boolean stderrSet = !executionCommand.resultData.stderr.toString().isEmpty();
|
boolean stderrSet = !executionCommand.resultData.stderr.toString().isEmpty();
|
||||||
if (executionCommand.resultData.exitCode != 0 || stderrSet) {
|
if (executionCommand.resultData.exitCode != 0 || stderrSet) {
|
||||||
Logger.logError(LOG_TAG, executionCommand.toString());
|
Logger.logErrorExtended(LOG_TAG, executionCommand.toString());
|
||||||
if (stderrSet)
|
if (stderrSet)
|
||||||
logcatOutput.append("\n").append(executionCommand.resultData.stderr.toString());
|
logcatOutput.append("\n").append(executionCommand.resultData.stderr.toString());
|
||||||
logcatOutput.append("\n").append("exit code: ").append(executionCommand.resultData.exitCode.toString());
|
logcatOutput.append("\n").append("exit code: ").append(executionCommand.resultData.exitCode.toString());
|
||||||
|
Reference in New Issue
Block a user