Capturing Logs

Capture native Android app events, live-session log lines, SDK diagnostics, and grouped session properties.

Use app events for timeline entries. Use sendClientLog(...) for ad hoc live-session log lines.

App Events

import ai.ansight.runtime.AnsightEventType

AnsightRuntime.event(
    label = "Checkout loaded",
    type = AnsightEventType.Info,
    details = "route=/checkout",
)

AnsightRuntime.event(
    label = "Payment failed",
    type = AnsightEventType.Error,
    details = "httpStatus=500",
)

Live Client Logs

val result = AnsightRuntime.sendClientLog("Checkout loaded cartId=debug-42")

sendClientLog(...) sends the line over an active live session. It does not automatically mirror Logcat or third-party logging frameworks.

SDK Diagnostics

val callback = AnsightLogCallback { level, message, throwable ->
    Log.d("Ansight", "[$level] $message", throwable)
}

AnsightLogger.registerCallback(callback)
AnsightLogger.removeCallback(callback)

Session Properties

Ansight.registerCustomProperty("app", "region", "au")
Ansight.removeCustomProperty("app", "region")
Ansight.clearCustomProperties()

Grouped properties are sent with session.open and updated during an active live session.