Best practise for Logcat colours in Android Studio!

Android Studio Logcat color scheme Preferences
Standard

I know that using solid black colour logcat in Android Studio  is awful !!!

Here is my best practice colour codes that you can use for changing the face of you logcat in Android Studio to make it more useful. go to Android Studio Preferences and search for logcat and save as your own scheme:

Assert9C27B0
Debug2196F3
ErrorF44336
Info4CAF50
WarningFFC107

All colours are picked from material design colour pattern: https://www.google.com/design/spec/style/color.html

How to enable Android retrofit2 network library logging?

Standard

As any one who had an experiment with retrofit2 knows, logging is some times required to check what is happening!

Since the retrofit2 required HTTP layer is now completely based on OkHttp, the developers of OkHttp added a logging interceptor in release 2.6.0

add to your build.gradle file:

dependencies {
    compile 'com.squareup.retrofit2:retrofit:2.0.0-beta3'
    compile 'com.squareup.retrofit2:converter-gson:2.0.0-beta3'
    compile 'com.squareup.okhttp3:logging-interceptor:3.0.0-RC1'
    ...
}

and this is how to build retrofit:

Retrofit.Builder builder = new Retrofit.Builder()
                .baseUrl(Consts.BASE_URL)
                .addConverterFactory(GsonConverterFactory.create());

        //show retrofit logs if is debugging
        if (sIsDebug) {
            HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
            logging.setLevel(HttpLoggingInterceptor.Level.BODY);
            OkHttpClient.Builder httpClient = new OkHttpClient.Builder();
            httpClient.addInterceptor(logging);

            builder.client(httpClient.build());
        }

        mRetrofit = builder.build();

now have fun with logs at logcat…