Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(399)

Side by Side Diff: docs/android_logging.md

Issue 1581983002: [doc] logging: explain how to enable it in junit tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/android/java/src/org/chromium/base/Log.java ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Logging # 1 # Logging #
2 2
3 [TOC] 3 [TOC]
4 4
5 5
6 ## Overview 6 ## Overview
7 7
8 Logging used to be done using Android's [android.util.Log] 8 Logging used to be done using Android's [android.util.Log]
9 (http://developer.android.com/reference/android/util/Log.html). 9 (http://developer.android.com/reference/android/util/Log.html).
10 10
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 ```shell 199 ```shell
200 export ANDROID_LOG_TAGS="cr_YourModuleTag:D *:S" 200 export ANDROID_LOG_TAGS="cr_YourModuleTag:D *:S"
201 ``` 201 ```
202 202
203 The syntax does not support tag expansion or regular expressions other than `*` 203 The syntax does not support tag expansion or regular expressions other than `*`
204 for all tags. Please use `grep` or a similar tool to refine your filters 204 for all tags. Please use `grep` or a similar tool to refine your filters
205 further. 205 further.
206 206
207 For more, see the [related page on developer.android.com] 207 For more, see the [related page on developer.android.com]
208 (http://developer.android.com/tools/debugging/debugging-log.html#filteringOutput ) 208 (http://developer.android.com/tools/debugging/debugging-log.html#filteringOutput )
209
210 ## Logs in JUnit tests
211
212 We use [robolectric](http://robolectric.org/) to run our JUnit tests. It
213 replaces some of the Android framework classes with "Shadow" classes
214 to ensure that we can run our code in a regular JVM. `android.util.Log` is one
215 of those replaced classes, and by default calling `Log` methods doesn't print
216 anything.
217
218 That default is not changed in the normal configuration, but if you need to
219 enable logging locally or for a specific test, just add those few lines to your
220 test:
221
222 ```java
223 @Before
224 public void setUp() {
225 ShadowLog.stream = System.out;
226 //you other setup here
227 }
228 ```
OLDNEW
« no previous file with comments | « base/android/java/src/org/chromium/base/Log.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698