crypto: Connect the rust logger to timber

This commit is contained in:
Damir Jelić 2021-02-16 11:26:24 +01:00
parent 4589b882c0
commit d50df9537c
2 changed files with 16 additions and 0 deletions

View File

@ -57,6 +57,7 @@ import org.matrix.android.sdk.api.session.room.model.RoomHistoryVisibilityConten
import org.matrix.android.sdk.api.session.room.model.RoomMemberContent
import org.matrix.android.sdk.api.util.JsonDict
import org.matrix.android.sdk.internal.OlmMachine
import org.matrix.android.sdk.internal.setRustLogger
import org.matrix.android.sdk.internal.crypto.actions.MegolmSessionDataImporter
import org.matrix.android.sdk.internal.crypto.actions.SetDeviceVerificationAction
import org.matrix.android.sdk.internal.crypto.algorithms.IMXEncrypting
@ -375,6 +376,7 @@ internal class DefaultCryptoService @Inject constructor(
Timber.v("HELLLO WORLD STARTING CRYPTO")
try {
setRustLogger()
olmMachine = OlmMachine(userId, deviceId!!, dataDir)
Timber.v("HELLLO WORLD STARTING $dataDir CRYPTO ${olmMachine?.identityKeys()}")

View File

@ -24,6 +24,20 @@ import uniffi.olm.OlmMachine as InnerMachine
import uniffi.olm.Request
import uniffi.olm.RequestType
import uniffi.olm.Sas as InnerSas
import uniffi.olm.Logger
import uniffi.olm.setLogger
import timber.log.Timber
class CryptoLogger(): Logger {
override fun log(logLine: String) {
Timber.d(logLine)
}
}
fun setRustLogger() {
setLogger(CryptoLogger() as Logger)
}
class Device(inner: InnerDevice, machine: InnerMachine) {
private val machine: InnerMachine = machine