Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LatinIME
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
keyboard
LatinIME
Commits
583a1edc
Commit
583a1edc
authored
12 years ago
by
Kurt Partridge
Browse files
Options
Downloads
Patches
Plain Diff
[Rlog22] ResearchLogger fixed debug printing
Change-Id: I2c59983236c936b8698004db8213b68c2f964cd5
parent
5a7ac3bf
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
java/src/com/android/inputmethod/research/LogUnit.java
+35
-0
35 additions, 0 deletions
java/src/com/android/inputmethod/research/LogUnit.java
with
35 additions
and
0 deletions
java/src/com/android/inputmethod/research/LogUnit.java
+
35
−
0
View file @
583a1edc
...
...
@@ -24,10 +24,12 @@ import android.view.inputmethod.CompletionInfo;
import
com.android.inputmethod.keyboard.Key
;
import
com.android.inputmethod.latin.SuggestedWords
;
import
com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo
;
import
com.android.inputmethod.latin.Utils
;
import
com.android.inputmethod.latin.define.ProductionFlag
;
import
com.android.inputmethod.research.ResearchLogger.LogStatement
;
import
java.io.IOException
;
import
java.io.StringWriter
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -95,6 +97,22 @@ import java.util.Map;
*/
public
synchronized
void
publishTo
(
final
ResearchLog
researchLog
,
final
boolean
isIncludingPrivateData
)
{
// Prepare debugging output if necessary
final
StringWriter
debugStringWriter
;
final
JsonWriter
debugJsonWriter
;
if
(
DEBUG
)
{
debugStringWriter
=
new
StringWriter
();
debugJsonWriter
=
new
JsonWriter
(
debugStringWriter
);
debugJsonWriter
.
setIndent
(
" "
);
try
{
debugJsonWriter
.
beginArray
();
}
catch
(
IOException
e
)
{
Log
.
e
(
TAG
,
"Could not open array in JsonWriter"
,
e
);
}
}
else
{
debugStringWriter
=
null
;
debugJsonWriter
=
null
;
}
final
int
size
=
mLogStatementList
.
size
();
// Write out any logStatement that passes the privacy filter.
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
...
...
@@ -110,6 +128,23 @@ import java.util.Map;
final
JsonWriter
jsonWriter
=
researchLog
.
getValidJsonWriterLocked
();
outputLogStatementToLocked
(
jsonWriter
,
mLogStatementList
.
get
(
i
),
mValuesList
.
get
(
i
),
mTimeList
.
get
(
i
));
if
(
DEBUG
)
{
outputLogStatementToLocked
(
debugJsonWriter
,
mLogStatementList
.
get
(
i
),
mValuesList
.
get
(
i
),
mTimeList
.
get
(
i
));
}
}
if
(
DEBUG
)
{
try
{
debugJsonWriter
.
endArray
();
debugJsonWriter
.
flush
();
}
catch
(
IOException
e
)
{
Log
.
e
(
TAG
,
"Could not close array in JsonWriter"
,
e
);
}
final
String
bigString
=
debugStringWriter
.
getBuffer
().
toString
();
final
String
[]
lines
=
bigString
.
split
(
"\n"
);
for
(
String
line
:
lines
)
{
Log
.
d
(
TAG
,
line
);
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment