我现在正在使用 Timber
库来过滤掉所有我不关心的垃圾
implementation 'com.jakewharton.timber:timber:4.7.1'
创建自定义的树类:
class CustomTagTree(private val customTag: String) : Timber.DebugTree() {
override fun createStackElementTag(element: StackTraceElement): String {
return customTag
}
}
class BaseApplication : Application() {
override fun onCreate() {
super.onCreate()
if (BuildConfig.DEBUG) {
Timber.plant(CustomTagTree("ihatethenewlogcat"))
}
}
}
添加姓名到清单:
<application
android:name=".BaseApplication"
现在使用
Timber.d("Called")