chore(http): log failed requests only
Per-request GET success logs (39 long URLs per teacher sync) flood the 2MB logcat buffer together with system ZeroHung spam, drowning the real kill reason (am_proc_died / lowmemorykiller). Log only non-2xx responses.
This commit is contained in:
@@ -22,7 +22,7 @@ object VyatsuHttpClient {
|
||||
|
||||
suspend fun getText(url: String): String = withContext(Dispatchers.IO) {
|
||||
client.newCall(Request.Builder().url(url).build()).execute().use { resp ->
|
||||
Log.d(TAG, "GET $url -> ${resp.code}")
|
||||
if (!resp.isSuccessful) Log.e(TAG, "GET $url -> HTTP ${resp.code}")
|
||||
check(resp.isSuccessful) { "HTTP ${resp.code} for $url" }
|
||||
resp.body!!.string()
|
||||
}
|
||||
@@ -30,7 +30,7 @@ object VyatsuHttpClient {
|
||||
|
||||
suspend fun getBytes(url: String): ByteArray = withContext(Dispatchers.IO) {
|
||||
client.newCall(Request.Builder().url(url).build()).execute().use { resp ->
|
||||
Log.d(TAG, "GET $url -> ${resp.code}")
|
||||
if (!resp.isSuccessful) Log.e(TAG, "GET $url -> HTTP ${resp.code}")
|
||||
check(resp.isSuccessful) { "HTTP ${resp.code} for $url" }
|
||||
resp.body!!.bytes()
|
||||
}
|
||||
@@ -42,7 +42,7 @@ object VyatsuHttpClient {
|
||||
*/
|
||||
suspend fun openStream(url: String): InputStream = withContext(Dispatchers.IO) {
|
||||
val resp = client.newCall(Request.Builder().url(url).build()).execute()
|
||||
Log.d(TAG, "GET $url -> ${resp.code}")
|
||||
if (!resp.isSuccessful) Log.e(TAG, "GET $url -> HTTP ${resp.code}")
|
||||
check(resp.isSuccessful) { "HTTP ${resp.code} for $url" }
|
||||
resp.body!!.byteStream()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user