Filter logs from UI
suggest changeAndroid logs can be filtered directly from the UI. Using this code
public class MainActivity extends AppCompatActivity {
private final static String TAG1 = MainActivity.class.getSimpleName();
private final static String TAG2 = MainActivity.class.getCanonicalName();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Log.e(TAG1,"Log from onCreate method with TAG1");
Log.i(TAG2,"Log from onCreate method with TAG2");
}
}
If I use the regex TAG1|TAG2
and the level verbose
I get
01-14 10:34:46.961 12880-12880/android.doc.so.thiebaudthomas.sodocandroid E/MainActivity: Log from onCreate method with TAG1
01-14 10:34:46.961 12880-12880/android.doc.so.thiebaudthomas.sodocandroid I/androdi.doc.so.thiebaudthomas.sodocandroid.MainActivity: Log from onCreate method with TAG2
The level can be set to get logs with given level and above. For example the verbose
level will catch verbose, debug, info, warn, error and assert
logs.
Using the same example, if I set the level to error
, I only get
01-14 10:34:46.961 12880-12880/androdi.doc.so.thiebaudthomas.sodocandroid E/MainActivity: Log from onCreate method with TAG1
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents