在我们日常开发过程中,遇到Bug经常需要打Log来跟踪定位问题,但是测试同学拿着手机找到你的时候,你更多的时候是一脸懵,只能将手机与电脑连接,然后run一下,打开Studio的控制台,然后过滤你需要的信息,才可能看到你需要的信息,但有时候由于部分机型打印的Log过多,你想要的信息可能刷一下就跳过去了,你想要看到的信息没有拿到,就算你拿到了,也有可能是服务端数据的问题,导致占用你很长的时间来跟踪,如果我们的log信息在应用内可以很直观的看到,是不是就省去了这些步骤呢?
dependencies {
implementation 'com.github.LiuShuai1020:DeveloperModel:1.0.0.1'
}
DeveloperModelManager.init(this);
DeveloperModelManager.onClick();
DeveloperModelManager.setClickNumber(5);
DeveloperModelManager.setDeveloperModelState(DeveloperStateModel.DEVELOPER_STATE_OPEN);
DeveloperModelManager.setDeveloperState(DeveloperStateModel.DEVELOPER_STATE_CLOSE);
DeveloperModelManager.setDeveloperState(DeveloperStateModel.DEVELOPER_STATE_OPEN, false);
- 正常信息(normal 默认色)
- 警告信息(warn 黄色)
- 错误信息(error 红色)
DeveloperModelManager.setLog(TAG, "Developer 正常信息");
DeveloperModelManager.setNormalLog(TAG, "Developer 正常信息");
DeveloperModelManager.setWarnLog(TAG, "Developer 警告信息");
DeveloperModelManager.setErrorLog(TAG, "Developer 错误信息");
<com.liushiyu.developer.DeveloperLogView
android:id="@+id/mDeveloperLogView"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
需要注意的是,数据的插入和删除都是异步处理的,数据查询目前是同步查来的,所以在for循环中打印信息的话,来到开发者模式的页面,有可能数据没有打印完成,这时候需要你手动查询。清除数据也是异步来处理的,如果数据量大的话,会有清除不干净的问题,所以在当前页面点击清除数据后,列表没有数据了,这时表示删除成功了。
implementation 'com.github.LiuShuai1020:Tooltip:1.0.1.1'
implementation 'org.greenrobot:greendao:3.2.2'
implementation 'net.zetetic:android-database-sqlcipher:3.5.4'
implementation 'io.reactivex.rxjava2:rxjava:2.1.9'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
implementation 'com.google.code.gson:gson:2.7'
implementation 'com.android.support:recyclerview-v7:27.1.1'