breadcrumbHandler
Custom breadcrumb handler for SDK events.
Overview
The breadcrumbHandler property allows you to override the default breadcrumb logging behavior of the SDK. Breadcrumbs are informational events that help trace SDK operation. By default, breadcrumbs are printed to the console. You can provide a custom handler to integrate with your app's logging system.
Syntax
var breadcrumbHandler: (message: String, e: Throwable?) -> Unit
Parameters
The handler function receives two parameters:
| Parameter | Type | Description |
|---|---|---|
message | String | Breadcrumb message describing the event |
e | Throwable? | Optional exception associated with the breadcrumb |
Example
// Set up custom breadcrumb handling
MaestroSDK.breadcrumbHandler = { message, throwable ->
// Log to your analytics or logging service
Log.d("Maestro", message, throwable)
// Optionally send to analytics
analytics.logEvent("maestro_breadcrumb", mapOf(
"message" to message
))
}
// Then configure the SDK
val sdk = MaestroSDK.configure(
context = applicationContext,
maestroEventDelegate = this,
params = MaestroSDKParameters(siteId = "your-site-id"),
)
Notes
- Set this handler before calling
configure()to capture all breadcrumbs - The default handler prints breadcrumbs to the console
- Breadcrumbs are useful for debugging and understanding SDK behavior
- Breadcrumbs are informational and don't indicate errors