log-notice.md 910 B

使用三方库 Chucker 在通知栏记录网络请求日志

![](https://github.com/ChuckerTeam/chucker/raw/main/assets/chucker-http.gif){ width="300" }
Chucker

依赖

implementation "com.github.chuckerteam.chucker:library:3.5.2"

添加拦截器

NetConfig.initialize(Api.HOST, this) {
    // ...
    if (BuildConfig.DEBUG) {
        addInterceptor(
            ChuckerInterceptor.Builder(this@App)
                .collector(ChuckerCollector(this@App))
                .maxContentLength(250000L)
                .redactHeaders(emptySet())
                .alwaysReadResponseBody(false)
                .build()
        )
    }
}

自定义功能浏览 Chucker 官网