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 returnResult<(), TimberlogsError>:
Data Object
Thedata parameter accepts Option<HashMap<String, serde_json::Value>>:
Tags
Tags help categorize and filter logs. Add them via theLogEntry:
Flow Tracking
Flows group related logs across a multi-step process with automatic flow IDs and step indexing.Creating a Flow
Use theflow() method to create a new flow. This is an async operation that creates the flow on the server:
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
Uselog_with_level for full control:
Level Filtering with Flows
When usingmin_level configuration, filtered logs don’t increment the step index: