Tables

AndroidiOS

Availability: the Tables plugin is not included in the current release. The snapbug-tables module is temporarily disabled and the inspector does not yet have a Tables view. The feature is planned to return in a future version; the page below describes the intended API.

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:

Snapbug.tablePlugin.table("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 in the inspector.

Use Cases

User Session Tracking

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

Cache Monitoring

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

Business Events

Snapbug.tablePlugin.table("Orders").log(
    "order_id" toParam order.id,
    "status" toParam order.status.name,
    "total" toParam order.total.toString(),
    "items_count" toParam order.items.size.toString()
)

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 inspector.

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