Terser Coloring LogCat?

To speed up my debugging, I highlight specific messages for instant detection, for example:

if (isOK) Log.i(TAG, stringVarContentOfMessage); else Log.v(TAG, stringVarContentOfMessage); 

It works, but scans this source code again and again, where the only excuse for engaging in 4 precious lines is only one different symbol (Log.i vs. Log.v) for me.

Any suggestions for caring for this thorn without resorting to the following:

 isOK ? Log.i(TAG, stringVarContentOfMessage) : Log.v(TAG, stringVarContentOfMessage); 
+6
source share
3 answers

You can use Log.println() :

 Log.println(isOK ? Log.INFO : Log.VERBOSE, TAG, stringVarContentOfMessage); 
+3
source

Create a helper method:

 private void conditionalLog(boolean flag, String tag, String message); 
+3
source

The best way is color from the other end. Just select the colored logcat messages. See: Changing the Android Logarithm Flow for Full Color Debugging This is a Python script that you can easily modify as you like.

0
source

Source: https://habr.com/ru/post/896879/


All Articles