perf: convert remaining 12 interpolated log calls to lambda overloads

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
davotoula
2026-03-29 13:07:34 +02:00
parent c17fb4641a
commit c40c1ed383
7 changed files with 12 additions and 12 deletions
@@ -132,7 +132,7 @@ class RegisterAccounts(
val client = client(url) val client = client(url)
client.newCall(request).executeAsync().use { response -> client.newCall(request).executeAsync().use { response ->
Log.i(tag, "Server registration ${response.isSuccessful}") Log.i(tag) { "Server registration ${response.isSuccessful}" }
} }
} }
@@ -299,7 +299,7 @@ object VideoCompressionHelper {
if (cursor.moveToFirst()) cursor.getLong(sizeIndex) else 0L if (cursor.moveToFirst()) cursor.getLong(sizeIndex) else 0L
} ?: 0L } ?: 0L
} catch (e: Exception) { } catch (e: Exception) {
Log.w(LOG_TAG, "Failed to get file size: ${e.message}") Log.w(LOG_TAG) { "Failed to get file size: ${e.message}" }
0L 0L
} }
@@ -348,13 +348,13 @@ object VideoCompressionHelper {
null null
} }
} catch (e: Exception) { } catch (e: Exception) {
Log.w(LOG_TAG, "Failed to get video resolution: ${e.message}") Log.w(LOG_TAG) { "Failed to get video resolution: ${e.message}" }
null null
} finally { } finally {
try { try {
retriever?.release() retriever?.release()
} catch (e: Exception) { } catch (e: Exception) {
Log.w(LOG_TAG, "Failed to release MediaMetadataRetriever: ${e.message}") Log.w(LOG_TAG) { "Failed to release MediaMetadataRetriever: ${e.message}" }
} }
} }
} }
@@ -112,7 +112,7 @@ class VoiceAnonymizationController(
if (result.file.delete()) { if (result.file.delete()) {
Log.d(logTag) { "Deleted distorted file: ${result.file.absolutePath}" } Log.d(logTag) { "Deleted distorted file: ${result.file.absolutePath}" }
} else { } else {
Log.w(logTag, "Failed to delete distorted file: ${result.file.absolutePath}") Log.w(logTag) { "Failed to delete distorted file: ${result.file.absolutePath}" }
} }
} }
} catch (e: Exception) { } catch (e: Exception) {
@@ -250,7 +250,7 @@ object ShareHelper {
if (!renamed) { if (!renamed) {
tempFile.copyTo(sharableFile, overwrite = true) tempFile.copyTo(sharableFile, overwrite = true)
if (!tempFile.delete()) { if (!tempFile.delete()) {
Log.w(TAG, "Failed to delete temp file ${tempFile.path} after copy") Log.w(TAG) { "Failed to delete temp file ${tempFile.path} after copy" }
} }
} }
} }
@@ -57,7 +57,7 @@ class LargeDBInsertBenchmark : BaseLargeCacheBenchmark() {
try { try {
db.insert(event) db.insert(event)
} catch (e: SQLiteException) { } catch (e: SQLiteException) {
Log.w("LargeDBInsertBenchmark", "Error inserting event: ${e.message} for event: ${event.toJson()}") Log.w("LargeDBInsertBenchmark") { "Error inserting event: ${e.message} for event: ${event.toJson()}" }
} }
} }
runWithMeasurementDisabled { runWithMeasurementDisabled {
@@ -87,7 +87,7 @@ class LargeDBInsertBenchmark : BaseLargeCacheBenchmark() {
try { try {
db.insert(event) db.insert(event)
} catch (e: SQLiteException) { } catch (e: SQLiteException) {
Log.w("LargeDBInsertBenchmark", "Error inserting event: ${e.message} for event: ${event.toJson()}") Log.w("LargeDBInsertBenchmark") { "Error inserting event: ${e.message} for event: ${event.toJson()}" }
} }
} }
db db
@@ -97,7 +97,7 @@ class LargeDBInsertBenchmark : BaseLargeCacheBenchmark() {
try { try {
db.insert(event) db.insert(event)
} catch (e: SQLiteException) { } catch (e: SQLiteException) {
Log.w("LargeDBInsertBenchmark", "Error inserting event: ${e.message} for event: $event") Log.w("LargeDBInsertBenchmark") { "Error inserting event: ${e.message} for event: $event" }
} }
} }
@@ -61,7 +61,7 @@ class LargeDBQueryingBenchmark : BaseLargeCacheBenchmark() {
try { try {
db.insert(event) db.insert(event)
} catch (e: SQLiteException) { } catch (e: SQLiteException) {
Log.w("LargeDBQueryingBenchmark", "Error inserting event: ${e.message} for event: ${event.toJson()}") Log.w("LargeDBQueryingBenchmark") { "Error inserting event: ${e.message} for event: ${event.toJson()}" }
} }
} }
} }
@@ -59,12 +59,12 @@ class RelayLogger(
when (msg) { when (msg) {
is EventMessage -> if (debugReceiving) Log.d(logTag) { "Received: $msgStr" } is EventMessage -> if (debugReceiving) Log.d(logTag) { "Received: $msgStr" }
is EoseMessage -> if (debugReceiving) Log.d(logTag) { "EOSE: ${msg.subId}" } is EoseMessage -> if (debugReceiving) Log.d(logTag) { "EOSE: ${msg.subId}" }
is NoticeMessage -> Log.w(logTag, "Notice: ${msg.message}") is NoticeMessage -> Log.w(logTag) { "Notice: ${msg.message}" }
is OkMessage -> if (debugReceiving) Log.d(logTag) { "OK: ${msg.eventId} ${msg.success} ${msg.message}" } is OkMessage -> if (debugReceiving) Log.d(logTag) { "OK: ${msg.eventId} ${msg.success} ${msg.message}" }
is AuthMessage -> if (debugReceiving) Log.d(logTag) { "Auth: ${msg.challenge}" } is AuthMessage -> if (debugReceiving) Log.d(logTag) { "Auth: ${msg.challenge}" }
is NotifyMessage -> if (debugReceiving) Log.d(logTag) { "Notify: ${msg.message}" } is NotifyMessage -> if (debugReceiving) Log.d(logTag) { "Notify: ${msg.message}" }
is CountMessage -> if (debugReceiving) Log.d(logTag) { "Count: ${msg.result.count} approx: ${msg.result.approximate} hll: ${msg.result.hll != null}" } is CountMessage -> if (debugReceiving) Log.d(logTag) { "Count: ${msg.result.count} approx: ${msg.result.approximate} hll: ${msg.result.hll != null}" }
is ClosedMessage -> Log.w(logTag, "Closed: ${msg.subId} ${msg.message}") is ClosedMessage -> Log.w(logTag) { "Closed: ${msg.subId} ${msg.message}" }
} }
} }