Updated on 2026-08-14
This commit is contained in:
parent
707e4294a4
commit
fa0b56675c
1 changed files with 22 additions and 1 deletions
|
|
@ -44,7 +44,11 @@ class NetworkLogsSaveInterceptor(
|
|||
throw e
|
||||
}
|
||||
|
||||
logResponseMessage(response, startNs)
|
||||
if (restrictedForLogURLs.contains(request.url.host + request.url.encodedPath)) {
|
||||
logResponseWithEmptyMessage(response, startNs)
|
||||
} else {
|
||||
logResponseMessage(response, startNs)
|
||||
}
|
||||
|
||||
return response
|
||||
}
|
||||
|
|
@ -87,6 +91,14 @@ class NetworkLogsSaveInterceptor(
|
|||
}
|
||||
}
|
||||
|
||||
private fun logResponseWithEmptyMessage(response: Response, startNs: Long) {
|
||||
val tookMs = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startNs)
|
||||
saveLogMessage(
|
||||
"<-- ${response.code}",
|
||||
" ${response.request.url} (${tookMs}ms)\n",
|
||||
)
|
||||
}
|
||||
|
||||
private fun logResponseMessage(response: Response, startNs: Long) {
|
||||
val responseHeaders = response.headers
|
||||
val responseBody = response.body!!
|
||||
|
|
@ -202,4 +214,13 @@ class NetworkLogsSaveInterceptor(
|
|||
private fun saveLogMessage(vararg messages: String) {
|
||||
appLogsStore.saveLogMessage(tag = "NetworkLogs", *messages)
|
||||
}
|
||||
|
||||
private companion object {
|
||||
/**
|
||||
* List of URLs (host + path) for which logging is restricted
|
||||
*/
|
||||
val restrictedForLogURLs = listOf(
|
||||
"api.stakek.it/v1/yields/enabled",
|
||||
)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue