AnalyticsLogger

Central logger for managing analytics events in the DevView Analytics module.

This singleton object provides thread-safe, reactive storage for analytics logs using Compose's snapshot state system. All logged events are stored in-memory and can be observed reactively by UI components.

Usage

Logging Events

AnalyticsLogger.log(
AnalyticsLog(
tag = "user_login",
screenClass = "LoginScreen",
timestamp = Clock.System.now().toEpochMilliseconds(),
type = AnalyticsLogCategory.Session.Login
)
)

Accessing Logs

val allLogs = AnalyticsLogger.logs
val hasAnyLogs = AnalyticsLogger.hasLogs

Clearing Logs

// Internal use only
AnalyticsLogger.clear()

See also

Properties

Link copied to clipboard

Indicates whether any analytics logs have been recorded.

Link copied to clipboard

Returns a snapshot state list of all analytics logs.

Functions

Link copied to clipboard
fun log(log: AnalyticsLog)

Adds a new analytics log entry to the internal storage.