Required Options
| Option | Type | Description |
|---|---|---|
source | string | Your application or service name. Used to filter logs. |
environment | 'development' | 'staging' | 'production' | The environment your app is running in. |
apiKey | string | Your Timberlogs API key (starts with tb_live_ or tb_test_). |
Optional Options
| Option | Type | Default | Description |
|---|---|---|---|
version | string | - | Your application version (e.g., '1.2.3'). |
dataset | string | 'default' | Default dataset for grouping/routing logs. |
userId | string | - | Default user ID attached to all logs. |
sessionId | string | - | Default session ID attached to all logs. |
batchSize | number | 10 | Number of logs to batch before sending. |
flushInterval | number | 5000 | Milliseconds between auto-flush. |
minLevel | LogLevel | 'debug' | Minimum level to send (debug, info, warn, error). |
onError | function | - | Called when sending fails after all retries. |
retry | object | See below | Retry configuration for failed requests. |
Retry Configuration
The SDK automatically retries failed requests with exponential backoff.Log Level Filtering
UseminLevel to filter out lower-priority logs:
Setting User/Session at Runtime
You can update the user and session IDs after initialization:Validation Limits
Both SDKs validate fields before sending. Logs that exceed these limits will be rejected.| Field | Limit |
|---|---|
message | 1–10,000 characters |
source | 1–100 characters |
errorName | Max 200 characters |
errorStack | Max 10,000 characters |
userId, sessionId, requestId | Max 100 characters each |
flowId, dataset | Max 50 characters each |
stepIndex | 0–1,000 |
tags | Max 20 items, 50 characters each |