-
-
Save skydoves/7653ed29af68b21023be531dccfc55a9 to your computer and use it in GitHub Desktop.
customlogger
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val tagsToLog = setOf("checkout", "product-list", "search") | |
| ComposeStabilityAnalyzer.setLogger(object : RecompositionLogger { | |
| override fun log(event: RecompositionEvent) { | |
| if (BuildConfig.DEBUG) { | |
| // In debug, log everything | |
| Log.d("Recomposition", formatEvent(event)) | |
| } else { | |
| // In release, only log tagged composables that exceed threshold | |
| if (event.tag in tagsToLog && event.recompositionCount >= 5) { | |
| // Send to analytics | |
| FirebaseAnalytics.getInstance(this).logEvent("recomposition_issue", ...) | |
| } | |
| } | |
| } | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment