[tor-commits] [orbot/master] limit log length for diag share
n8fr8 at torproject.org
n8fr8 at torproject.org
Thu Apr 17 17:40:53 UTC 2014
commit b870dd3c7da0f0396975a70835524bbe2a8540c9
Author: Nathan Freitas <nathan at freitas.net>
Date: Thu Apr 17 13:39:49 2014 -0400
limit log length for diag share
---
src/org/torproject/android/OrbotDiagnosticsActivity.java | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/src/org/torproject/android/OrbotDiagnosticsActivity.java b/src/org/torproject/android/OrbotDiagnosticsActivity.java
index 453c0bc..f36d4c6 100644
--- a/src/org/torproject/android/OrbotDiagnosticsActivity.java
+++ b/src/org/torproject/android/OrbotDiagnosticsActivity.java
@@ -33,6 +33,7 @@ public class OrbotDiagnosticsActivity extends Activity {
private TextView mTextView = null;
private final static String TAG = "OrbotDiag";
+ private StringBuffer log = new StringBuffer();
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -310,6 +311,7 @@ public class OrbotDiagnosticsActivity extends Activity {
{
Log.d(TAG, msg);
mTextView.append(msg + '\n');
+ log.append(msg + '\n');
}
@@ -339,9 +341,18 @@ public class OrbotDiagnosticsActivity extends Activity {
private void sendLog ()
{
+ int maxLength = 5000;
+
+ String logShare = null;
+
+ if (log.length() > maxLength)
+ logShare = log.substring(0, maxLength);
+ else
+ logShare = log.toString();
+
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
- sendIntent.putExtra(Intent.EXTRA_TEXT, mTextView.getText().toString());
+ sendIntent.putExtra(Intent.EXTRA_TEXT, logShare);
sendIntent.setType("text/plain");
startActivity(sendIntent);
}
More information about the tor-commits
mailing list