Skip to main content

Installation

Basic Usage

Exports

The crate exports the following:

Logging Methods

debug(message, data)

Log debug-level messages for detailed diagnostic information.

info(message, data)

Log informational messages about normal operations.

warn(message, data)

Log warning conditions that might indicate a problem.

error(message, data)

Log errors.

log(entry)

Low-level logging method with full control over the log entry.

Error Handling

All async methods return Result<(), TimberlogsError>:

Data Object

The data parameter accepts Option<HashMap<String, serde_json::Value>>:

Tags

Tags help categorize and filter logs. Add them via the LogEntry:

Flow Tracking

Flows group related logs across a multi-step process with automatic flow IDs and step indexing.

Creating a Flow

Use the flow() method to create a new flow. This is an async operation that creates the flow on the server:
Each log is automatically tagged with:
  • flow_id (server-generated)
  • step_index: 0, 1, 2, 3 (auto-incrementing)

Flow Properties

Flow Logging Methods

Flows have the same logging methods as the main client:

Custom Level and Tags

Use log_with_level for full control:

Level Filtering with Flows

When using min_level configuration, filtered logs don’t increment the step index:
This ensures your step indices remain sequential without gaps.

Raw Format Ingestion

Send pre-formatted log data directly to the ingestion endpoint, bypassing the structured log pipeline.

ingest_raw(body, format, options)

Parameters:

Examples

CSV:
JSONL:
Plain text:

Supported Formats

Client Methods

set_user_id(user_id)

Set the default user ID for subsequent logs.

set_session_id(session_id)

Set the default session ID for subsequent logs.

flush()

Immediately send all queued logs.

disconnect()

Flush logs and stop the auto-flush timer. Always call this before your application exits.

Log Entry Struct

Ready to start logging? Sign up free — send your first log in under 5 minutes.