英文:
Easy way to let OkHTTP logging interceptor to log only requests?
问题
我正在使用OkHTTP HTTP请求的普通日志记录到Android logcat。但是,如果我将级别配置为打印BODY,我会得到大量的响应,导致logcat缓冲区溢出,有时会崩溃。因此,为了解决这个问题,我只想记录请求。
是否有一种几乎可以立即使用的方法来实现这一点?
英文:
I am using normal logging of OkHTTP HTTP Request to Android logcat. However, if I configure the level to print BODY I get huge loads of responses which cause logcat buffer overflow and sometimes crash. Thus to workaround it I would like to log only requests.
Is there an almost out-of-the-box way of doing this?
答案1
得分: 1
查看源代码,似乎并没有这个选项。如果尚未存在,请考虑提出一个功能请求。或者,您可以分叉存储库并贡献这个更改。或者,复制源代码并进行修改以适应 — 它基于当前的 main
分支不到 1000 行 Kotlin 代码。
英文:
Looking at the source code, it does not seem like that is an option. You might consider filing a feature request for this, if there is none already. Or, fork the repo and contribute the change. Or, copy the source and modify it to suit — it is less than 1000 lines of Kotlin, based on current main
.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论