refactor(log): convert interpolated Log calls to lambda overload

Avoid eager string interpolation when the log level is filtered out at
runtime. Covers Log.d/i calls and Log.w/e calls that did not pass a
throwable.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
davotoula
2026-05-04 10:15:22 +02:00
parent 42d2a50436
commit a22f63e42c
9 changed files with 48 additions and 48 deletions
@@ -142,7 +142,7 @@ class MarmotManager(
if (result is WelcomeResult.Joined) {
subscriptionManager.subscribeGroup(result.nostrGroupId)
Log.d("MarmotManager", "Joined group ${result.nostrGroupId}")
Log.d("MarmotManager") { "Joined group ${result.nostrGroupId}" }
}
return result
@@ -370,17 +370,17 @@ class MarmotManager(
try {
groupManager.clearAllState()
} catch (e: Exception) {
Log.w("MarmotManager", "resetAllState(): groupManager.clearAllState failed: ${e.message}")
Log.w("MarmotManager") { "resetAllState(): groupManager.clearAllState failed: ${e.message}" }
}
try {
keyPackageRotationManager.clearAllState()
} catch (e: Exception) {
Log.w("MarmotManager", "resetAllState(): keyPackageRotationManager.clearAllState failed: ${e.message}")
Log.w("MarmotManager") { "resetAllState(): keyPackageRotationManager.clearAllState failed: ${e.message}" }
}
try {
subscriptionManager.clear()
} catch (e: Exception) {
Log.w("MarmotManager", "resetAllState(): subscriptionManager.clear failed: ${e.message}")
Log.w("MarmotManager") { "resetAllState(): subscriptionManager.clear failed: ${e.message}" }
}
}
@@ -405,7 +405,7 @@ class MarmotManager(
try {
messageStore?.delete(nostrGroupId)
} catch (e: Exception) {
Log.w("MarmotManager", "Failed to delete persisted messages for $nostrGroupId: ${e.message}")
Log.w("MarmotManager") { "Failed to delete persisted messages for $nostrGroupId: ${e.message}" }
}
return outboundEvent
}
@@ -423,7 +423,7 @@ class MarmotManager(
try {
messageStore?.appendMessage(nostrGroupId, innerEventJson)
} catch (e: Exception) {
Log.w("MarmotManager", "Failed to persist Marmot message for $nostrGroupId: ${e.message}")
Log.w("MarmotManager") { "Failed to persist Marmot message for $nostrGroupId: ${e.message}" }
}
}
@@ -435,7 +435,7 @@ class MarmotManager(
try {
messageStore?.loadMessages(nostrGroupId) ?: emptyList()
} catch (e: Exception) {
Log.w("MarmotManager", "Failed to load persisted messages for $nostrGroupId: ${e.message}")
Log.w("MarmotManager") { "Failed to load persisted messages for $nostrGroupId: ${e.message}" }
emptyList()
}