Merge pull request #5132 from element-hq/feature/bma/rageshakeConfig
Let enterprise build store the logs in a dedicated subfolder
This commit is contained in:
commit
8a163fc7d2
13 changed files with 325 additions and 75 deletions
|
|
@ -11,4 +11,6 @@ import timber.log.Timber
|
|||
|
||||
interface TracingService {
|
||||
fun createTimberTree(target: String): Timber.Tree
|
||||
|
||||
fun updateWriteToFilesConfiguration(config: WriteToFilesConfiguration)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,9 +71,9 @@ class RustMatrixAuthenticationService @Inject constructor(
|
|||
private var currentClient: Client? = null
|
||||
private var currentHomeserver = MutableStateFlow<MatrixHomeServerDetails?>(null)
|
||||
|
||||
private var newMatrixClientObserver: ((MatrixClient) -> Unit)? = null
|
||||
private val newMatrixClientObservers = mutableListOf<(MatrixClient) -> Unit>()
|
||||
override fun listenToNewMatrixClients(lambda: (MatrixClient) -> Unit) {
|
||||
newMatrixClientObserver = lambda
|
||||
newMatrixClientObservers.add(lambda)
|
||||
}
|
||||
|
||||
private fun rotateSessionPath(): SessionPaths {
|
||||
|
|
@ -155,7 +155,8 @@ class RustMatrixAuthenticationService @Inject constructor(
|
|||
passphrase = pendingPassphrase,
|
||||
sessionPaths = currentSessionPaths,
|
||||
)
|
||||
newMatrixClientObserver?.invoke(rustMatrixClientFactory.create(client))
|
||||
val matrixClient = rustMatrixClientFactory.create(client)
|
||||
newMatrixClientObservers.forEach { it.invoke(matrixClient) }
|
||||
sessionStore.storeData(sessionData)
|
||||
|
||||
// Clean up the strong reference held here since it's no longer necessary
|
||||
|
|
@ -246,7 +247,8 @@ class RustMatrixAuthenticationService @Inject constructor(
|
|||
pendingOAuthAuthorizationData?.close()
|
||||
pendingOAuthAuthorizationData = null
|
||||
|
||||
newMatrixClientObserver?.invoke(rustMatrixClientFactory.create(client))
|
||||
val matrixClient = rustMatrixClientFactory.create(client)
|
||||
newMatrixClientObservers.forEach { it.invoke(matrixClient) }
|
||||
sessionStore.storeData(sessionData)
|
||||
|
||||
// Clean up the strong reference held here since it's no longer necessary
|
||||
|
|
@ -290,7 +292,8 @@ class RustMatrixAuthenticationService @Inject constructor(
|
|||
passphrase = pendingPassphrase,
|
||||
sessionPaths = emptySessionPaths,
|
||||
)
|
||||
newMatrixClientObserver?.invoke(rustMatrixClientFactory.create(client))
|
||||
val matrixClient = rustMatrixClientFactory.create(client)
|
||||
newMatrixClientObservers.forEach { it.invoke(matrixClient) }
|
||||
sessionStore.storeData(sessionData)
|
||||
|
||||
// Clean up the strong reference held here since it's no longer necessary
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import io.element.android.libraries.matrix.api.tracing.TracingConfiguration
|
|||
import io.element.android.libraries.matrix.api.tracing.TracingService
|
||||
import io.element.android.libraries.matrix.api.tracing.WriteToFilesConfiguration
|
||||
import org.matrix.rustcomponents.sdk.TracingFileConfiguration
|
||||
import org.matrix.rustcomponents.sdk.reloadTracingFileWriter
|
||||
import timber.log.Timber
|
||||
import javax.inject.Inject
|
||||
|
||||
|
|
@ -23,6 +24,12 @@ class RustTracingService @Inject constructor(private val buildMeta: BuildMeta) :
|
|||
override fun createTimberTree(target: String): Timber.Tree {
|
||||
return RustTracingTree(target = target, retrieveFromStackTrace = buildMeta.isDebuggable)
|
||||
}
|
||||
|
||||
override fun updateWriteToFilesConfiguration(config: WriteToFilesConfiguration) {
|
||||
config.toTracingFileConfiguration()?.let {
|
||||
reloadTracingFileWriter(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun LogLevel.toRustLogLevel(): org.matrix.rustcomponents.sdk.LogLevel {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* Copyright 2025 New Vector Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
* Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
package io.element.android.libraries.matrix.test.tracing
|
||||
|
||||
import io.element.android.libraries.matrix.api.tracing.TracingService
|
||||
import io.element.android.libraries.matrix.api.tracing.WriteToFilesConfiguration
|
||||
import io.element.android.tests.testutils.lambda.lambdaError
|
||||
import timber.log.Timber
|
||||
|
||||
class FakeTracingService(
|
||||
private val createTimberTreeResult: (String) -> Timber.Tree = { lambdaError() },
|
||||
private val updateWriteToFilesConfigurationResult: (WriteToFilesConfiguration) -> Unit = { lambdaError() }
|
||||
) : TracingService {
|
||||
override fun createTimberTree(target: String): Timber.Tree {
|
||||
return createTimberTreeResult(target)
|
||||
}
|
||||
|
||||
override fun updateWriteToFilesConfiguration(config: WriteToFilesConfiguration) {
|
||||
updateWriteToFilesConfigurationResult(config)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue