Skip to content
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

handle logger creation failures #52

Merged
merged 19 commits into from
Oct 1, 2024
Merged

Conversation

Augustyniak
Copy link
Contributor

@Augustyniak Augustyniak commented Sep 27, 2024

Make platform layer handle cases where a Rust call to create a logger fails.

The way the logic works is that after the first time Logger.configure fails the consecutive attempts to configure the logger are no-ops. There is a public API change introduces in this PR on Android. Logger.configure(...) method returns an optional LoggerIntegrator object that used to be non-optional. For this reason, the next release will be 0.15.0.

Fixes BIT-3752

@Augustyniak Augustyniak requested review from murki and snowp September 30, 2024 19:43
/**
* Used for testing purposes.
*/
internal fun resetShared() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where do you use this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nowhere, leftover that I thought I removed. Removing for real time time...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, re-added it to fix flakiness of CaptureTest.kt tests

Copy link
Contributor

@murki murki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

by always catching at construction time you might've "fixed" other cases where the context.getSystemService might be null (see BIT-3712). Should be ok although we now incur the cost of shutting down the entire logger when the better solution would be to only shutdown the dependent ListenerLogger

@Augustyniak Augustyniak merged commit 751653c into main Oct 1, 2024
15 checks passed
@Augustyniak Augustyniak deleted the handle-logger-creation-error branch October 1, 2024 23:21
@github-actions github-actions bot locked and limited conversation to collaborators Oct 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants