Skip to content

How to enable Logger to show activity SDK? #67

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
roiskhoiron opened this issue Apr 16, 2025 · 1 comment
Closed

How to enable Logger to show activity SDK? #67

roiskhoiron opened this issue Apr 16, 2025 · 1 comment

Comments

@roiskhoiron
Copy link

roiskhoiron commented Apr 16, 2025

I never saw a configuration to enable logging, so that developers can more easily monitor sdk activity.

@roiskhoiron
Copy link
Author

I never saw a configuration to enable logging, so that developers can more easily monitor sdk activity.

I successfully enabled this feature by executing the following code snippet:

val rustTracingConfiguration = org.matrix.rustcomponents.sdk.TracingConfiguration(
                writeToStdoutOrSystem = BuildConfig.DEBUG,
                logLevel = org.matrix.rustcomponents.sdk.LogLevel.DEBUG,
                extraTargets = listOf("PackageName"),
                writeToFiles = org.matrix.rustcomponents.sdk.TracingFileConfiguration(
                    path = File(context.cacheDir, "logs").absolutePath,
                    filePrefix = "logs",
                    fileSuffix = "log",
                    maxFiles = 7uL,
                ),
            )
org.matrix.rustcomponents.sdk.setupTracing(rustTracingConfiguration)
Os.setenv("RUST_BACKTRACE", "1", true)

because this RUST_BACKTRACE variable will be executed by the low-level sdk at https://github.com/matrix-org/matrix-rust-sdk/blob/d36b2a6869d7e5960bf652daecba5ea2de8f1cbf/bindings/matrix-sdk-ffi/src/platform.rs#L19-L23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant