From eb7ee49096f6b87443785863cd5aa396ed4243f9 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 20 Nov 2020 09:04:04 +0100 Subject: [PATCH] Kotlin optimization form #1435 --- .../network/interceptors/FormattedJsonHttpLogger.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/matrix-sdk-android/src/debug/java/org/matrix/android/sdk/internal/network/interceptors/FormattedJsonHttpLogger.kt b/matrix-sdk-android/src/debug/java/org/matrix/android/sdk/internal/network/interceptors/FormattedJsonHttpLogger.kt index 5c03e8a855..630f6f1e29 100644 --- a/matrix-sdk-android/src/debug/java/org/matrix/android/sdk/internal/network/interceptors/FormattedJsonHttpLogger.kt +++ b/matrix-sdk-android/src/debug/java/org/matrix/android/sdk/internal/network/interceptors/FormattedJsonHttpLogger.kt @@ -66,9 +66,9 @@ class FormattedJsonHttpLogger : HttpLoggingInterceptor.Logger { } private fun logJson(formattedJson: String) { - val arr = formattedJson.split("\n".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray() - for (s in arr) { - Timber.v(s) - } + formattedJson + .lines() + .dropLastWhile { it.isEmpty() } + .forEach { Timber.v(it) } } }