JakeWharton / timber

A logger with a small, extensible API which provides utility on top of Android's normal Log class.
https://jakewharton.github.io/timber/docs/5.x/
Apache License 2.0
10.46k stars 962 forks source link

šŸ˜‡ Iā€™d like to add this to the ReadMe Documentation. #466

Open JosephRidge opened 2 years ago

JosephRidge commented 2 years ago

I added more details on the existing ReadMe file , focusing on setting up Timber once the dependencies have been downloaded.

Step 1 : Create an Application class that inherrits from Application class .

open class MyProjectApplication : Application() {
}

Step 2 : import the application package

import android.app.Application

Step 3 : override the onCreate() method and initialize the Timber class

override the onCreate() method in your Application class

open class MyProjectApplication : Application() {
    if (BuildConfig.DEBUG) {
      Timber.plant(new DebugTree());
    } else {
      Timber.plant(new CrashReportingTree());
    }
}

Step 4 : Define it in your Android Manifest , Application tag

In your application tag, add it as a name attribute :

<application  
        ....
        android:name=".MyProjectApplication"
        android:theme="@style/AppTheme"
       .... >

There was no clear set up process after setting up the dependencies .