Improve logs.

This commit is contained in:
Benoit Marty 2023-07-12 12:39:41 +02:00
parent 47b684f724
commit 1627dbfd27
3 changed files with 6 additions and 3 deletions

View file

@ -54,10 +54,12 @@ class MatrixClientsHolder @Inject constructor(private val authenticationService:
@Suppress("UNCHECKED_CAST")
fun restore(state: SavedStateMap?) {
Timber.d("Restore state")
if (state == null || sessionIdsToMatrixClient.isNotEmpty()) return Unit.also {
Timber.w("Restore with non-empty map")
}
val sessionIds = state[SAVE_INSTANCE_KEY] as? Array<SessionId>
Timber.d("Restore matrix session keys = ${sessionIds?.map { it.value }}")
if (sessionIds.isNullOrEmpty()) return
// Not ideal but should only happens in case of process recreation. This ensure we restore all the active sessions before restoring the node graphs.
runBlocking {
@ -76,7 +78,7 @@ class MatrixClientsHolder @Inject constructor(private val authenticationService:
fun save(state: MutableSavedStateMap) {
val sessionKeys = sessionIdsToMatrixClient.keys.toTypedArray()
Timber.d("Save matrix session keys = $sessionKeys")
Timber.d("Save matrix session keys = ${sessionKeys.map { it.value }}")
state[SAVE_INSTANCE_KEY] = sessionKeys
}
}

View file

@ -38,12 +38,13 @@ interface RoomSummaryDataSource {
suspend fun RoomSummaryDataSource.awaitAllRoomsAreLoaded(timeout: Duration = Duration.INFINITE) {
try {
Timber.d("awaitAllRoomsAreLoaded: wait")
withTimeout(timeout) {
allRoomsLoadingState().firstOrNull {
it is RoomSummaryDataSource.LoadingState.Loaded
}
}
} catch (timeoutException: TimeoutCancellationException) {
Timber.v("AwaitAllRooms: no response after $timeout")
Timber.d("awaitAllRoomsAreLoaded: no response after $timeout")
}
}

View file

@ -62,7 +62,7 @@ fun RoomListService.roomOrNull(roomId: String): RoomListItem? {
return try {
room(roomId)
} catch (exception: RoomListException) {
Timber.e(exception, "Failed finding room with id=$roomId")
Timber.d(exception, "Failed finding room with id=$roomId.")
return null
}
}