Tables

AndroidiOSDesktop

Tables let you log structured key-value data to named tables that update in real time. Use them to track session data, cache state, business events, or any data you want to inspect during development.

Features

  • Named tables with structured key-value rows
  • Real-time updates via log() calls
  • Kotlin Multiplatform compatible
  • Lightweight alternative to database logging

Basic Usage

Create a table and log entries with key-value pairs:

snapbugTable("User Sessions").log(
    "user_id" toParam "u_12345",
    "session_start" toParam "2025-01-15T10:30:00Z",
    "device" toParam "Pixel 8",
    "app_version" toParam "2.1.0"
)

Each call to log() adds a new row to the table, which appears instantly in the Desktop app.

Use Cases

User Session Tracking

snapbugTable("Sessions").log(
    "user_id" toParam currentUser.id,
    "login_method" toParam "google",
    "timestamp" toParam System.currentTimeMillis().toString()
)

Cache Monitoring

snapbugTable("Cache").log(
    "key" toParam cacheKey,
    "hit" toParam isHit.toString(),
    "size_bytes" toParam entry.size.toString(),
    "ttl_remaining" toParam ttl.toString()
)

Business Events

snapbugTable("Orders").log(
    "order_id" toParam order.id,
    "status" toParam order.status.name,
    "total" toParam order.total.toString(),
    "items_count" toParam order.items.size.toString()
)
info

Table names are used as identifiers. Logging to the same table name from different parts of your code will add rows to the same table in the Desktop app.

warning

All parameter values must be strings. Use toString() for non-string values.