-
Notifications
You must be signed in to change notification settings - Fork 861
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
建议 增加 interceptor 的概念 #41
Comments
主要是很多都在C层,没专门传递log,debug模式下的logcat是有一些 |
可以考虑先在 JAVA 层增加,后续看是否需要迭代到 C 层 现在打了日志,但是只能导出日志才可以查看(或者打两份日志),开发调试时颇为不便 |
你是说要看写入Logan的日志? |
是的,希望调试时,能在 logocat 直观看到明文的日志内容,在 Logan 设置 debug 模式时,发现只是输出一些 Logan 的操作日志,并非自己写入的内容。 如果要查看还需要将该日志导出或者其他途径去读取~ 总觉得在测试过程中并不是很便利(这个时候不禁想到 OkHttp 的 Interceptor ,增加拦截器后,在调试时的输出花样就多了)。 目前 Logan 加密和数据格式化都在 C 层,是否可以考虑通过拆包来解除耦合?这样就可以通过 |
明文看Logan日志内容,和Android自带的log没区别了呀,你在写入之前不就可以看到么。 |
Logan不是用来代替Log打日志用的,而是用来存储关键日志,进行个案分析的 |
通过拦截器对数据处理,实际操作一样可以放在 C 层,这并不影响拆包。 在调试过程中,关键日志同样需要在 Logocat 中可以查看,便于调试,于是就不得不多编写一份 Log 输出的代码。 if (BuildConfig.DEBUG) {
Log.e(xxx);
}
Logan.w(xxx); 虽然也可以通过包装一次 Logan 来处理这个问题 public class LoganDelegate{
public static void w(xxxx){
if (BuildConfig.DEBUG) {
Log.d(xxxx);
}
Logan.w(xxxx);
}
} 不过这个 issue 主要目的并不是说输出 logocat 这个功能,而是建议 当有了拦截器后,除了实际写入的拦截器,其他的以分包的形式发布供于选择 Logan.w -> DataEncapsulationInterceptor -> EncryptInterceptor -> WriteInterceptor |
我明白你的意思,不过在Logan中拦截器能做的确实有限,主要功能都在C,如果在java层只是定义拦截器配置传到C再去处理,就会徒增复杂度了。就比如你说要更改加密规则的前提是,C层要有实现才可以。 |
如果不放弃性能就会提升复杂度,个人觉得这块性能的影响应该可以忽略? |
这块我们再考虑下吧 |
建议增加 interceptor 的概念,用于对数据的处理,如加密、格式化( json、protobuf )、debug 模式下 logcat 输出,如 OkHttp 的 Interceptor
The text was updated successfully, but these errors were encountered: