groovy
implementation 'com.jakewharton.timber:timber:4.7.1'
public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
if (BuildConfig.DEBUG) {
Timber.plant(new Timber.DebugTree());
}
}
}
Timber.d("This is a debug log");
Timber.i("This is an info log");
Timber.w("This is a warning log");
Timber.e("This is an error log");
private static final String TAG = "MainActivity";
...
Timber.d(TAG, "This is a debug log");
Timber.with(new SampleTree())
.d("This is a debug log. Username = %s", sanitize(username));
groovy
implementation 'org.apache.logging.log4j:log4j-api:2.15.0'
implementation 'org.apache.logging.log4j:log4j-core:2.15.0'
Timber.plant(new Log4jTree());