OneManage Logo
OneManage Docs

Live Logs

OneManage.logger provides structured, fire-and-forget remote logging with four log levels. All logs are batched, compressed, and sent to your dashboard in the background — no performance impact on your app.


Basic Usage

import com.onemanage.OneManage

// Anywhere in your shared or platform code
OneManage.logger.info("HomeScreen",  "User opened home screen")
OneManage.logger.debug("Network",    "Request started: GET /config")
OneManage.logger.warn("Cache",       "Stale config — falling back to defaults")
OneManage.logger.error("Checkout",   "Payment failed: timeout after 30s")

Each call takes two parameters:

Parameter Description
tag A short label identifying the source (e.g. screen name, module)
message The log message

How it Works

Behaviour Detail
Batching Logs are queued in-memory and sent in batches of up to 50
Auto-flush The queue flushes automatically every 15 seconds
Offline persistence Failed batches are saved to a local SQLDelight DB and retried on next launch
Non-blocking All calls return immediately; networking happens on a background Default dispatcher

Manual Flush

Force an immediate send — useful before your app closes or before a critical user action:

// Suspending — call from a coroutine
OneManage.logger.flush()
// From a ViewModel
viewModelScope.launch {
    OneManage.logger.flush()
}

Compose Desktop — flush on window close

Window(onCloseRequest = {
    appScope.launch { OneManage.logger.flush() }
    exitApplication()
})

Log Levels

Level Method When to use
INFO logger.info(tag, msg) General app lifecycle events
DEBUG logger.debug(tag, msg) Detailed diagnostic information
WARN logger.warn(tag, msg) Recoverable issues or unexpected states
ERROR logger.error(tag, msg) Errors that affect user experience

API Reference

Method Description
info(tag, message) Enqueue an INFO log
warn(tag, message) Enqueue a WARN log
error(tag, message) Enqueue an ERROR log
debug(tag, message) Enqueue a DEBUG log
suspend flush() Immediately send all queued logs to the server