mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-18 05:39:53 +01:00
Display the Tor plugin's log output from previous Briar processes.
This commit is contained in:
@@ -322,11 +322,13 @@ public class TestingActivity extends BriarActivity implements OnClickListener {
|
|||||||
else btPluginStatus += "not running";
|
else btPluginStatus += "not running";
|
||||||
statusMap.put("Bluetooth plugin:", btPluginStatus);
|
statusMap.put("Bluetooth plugin:", btPluginStatus);
|
||||||
|
|
||||||
|
// All log output from the current process
|
||||||
StringBuilder log = new StringBuilder();
|
StringBuilder log = new StringBuilder();
|
||||||
try {
|
try {
|
||||||
int pid = android.os.Process.myPid();
|
int pid = android.os.Process.myPid();
|
||||||
Pattern pattern = Pattern.compile("./[^(]+\\( *" + pid + "\\):.*");
|
Pattern pattern = Pattern.compile(".*\\( *" + pid + "\\).*");
|
||||||
Process process = Runtime.getRuntime().exec("logcat -d *:I");
|
Runtime runtime = Runtime.getRuntime();
|
||||||
|
Process process = runtime.exec("logcat -d -v time *:I");
|
||||||
Scanner scanner = new Scanner(process.getInputStream());
|
Scanner scanner = new Scanner(process.getInputStream());
|
||||||
while(scanner.hasNextLine()) {
|
while(scanner.hasNextLine()) {
|
||||||
String line = scanner.nextLine();
|
String line = scanner.nextLine();
|
||||||
@@ -341,6 +343,22 @@ public class TestingActivity extends BriarActivity implements OnClickListener {
|
|||||||
}
|
}
|
||||||
statusMap.put("Debugging log:", log.toString());
|
statusMap.put("Debugging log:", log.toString());
|
||||||
|
|
||||||
|
// TorPlugin log output for all processes
|
||||||
|
StringBuilder torLog = new StringBuilder();
|
||||||
|
try {
|
||||||
|
Runtime runtime = Runtime.getRuntime();
|
||||||
|
Process process = runtime.exec("logcat -d -v time -s TorPlugin");
|
||||||
|
Scanner scanner = new Scanner(process.getInputStream());
|
||||||
|
while(scanner.hasNextLine()) {
|
||||||
|
torLog.append(scanner.nextLine());
|
||||||
|
torLog.append('\n');
|
||||||
|
}
|
||||||
|
scanner.close();
|
||||||
|
} catch(IOException e) {
|
||||||
|
if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
|
||||||
|
}
|
||||||
|
statusMap.put("Tor debugging log:", torLog.toString());
|
||||||
|
|
||||||
return Collections.unmodifiableMap(statusMap);
|
return Collections.unmodifiableMap(statusMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user