mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-16 04:39:54 +01:00
Show all logcat ouput for the current process in TestingActivity.
This commit is contained in:
@@ -32,6 +32,7 @@ import java.util.Scanner;
|
|||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
@@ -290,18 +291,22 @@ public class TestingActivity extends BriarActivity implements OnClickListener {
|
|||||||
|
|
||||||
StringBuilder log = new StringBuilder();
|
StringBuilder log = new StringBuilder();
|
||||||
try {
|
try {
|
||||||
Runtime runtime = Runtime.getRuntime();
|
int pid = android.os.Process.myPid();
|
||||||
Process process = runtime.exec("logcat -d -s TorPlugin");
|
Pattern pattern = Pattern.compile("./[^(]+\\( *" + pid + "\\):.*");
|
||||||
|
Process process = Runtime.getRuntime().exec("logcat -d *:I");
|
||||||
Scanner scanner = new Scanner(process.getInputStream());
|
Scanner scanner = new Scanner(process.getInputStream());
|
||||||
while(scanner.hasNextLine()) {
|
while(scanner.hasNextLine()) {
|
||||||
log.append(scanner.nextLine());
|
String line = scanner.nextLine();
|
||||||
log.append('\n');
|
if(pattern.matcher(line).matches()) {
|
||||||
|
log.append(line);
|
||||||
|
log.append('\n');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
scanner.close();
|
scanner.close();
|
||||||
} catch(IOException e) {
|
} catch(IOException e) {
|
||||||
if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
|
if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
|
||||||
}
|
}
|
||||||
statusMap.put("Tor log:", log.toString());
|
statusMap.put("Debugging log:", log.toString());
|
||||||
|
|
||||||
return Collections.unmodifiableMap(statusMap);
|
return Collections.unmodifiableMap(statusMap);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user