Expand description
Low-level Rust bindings for COVESA DLT (Diagnostic Log and Trace)
Safe Rust API for the DLT C library with RAII semantics, enabling applications to send diagnostic logs and traces to the DLT daemon for centralized logging and analysis.
§Quick Start
use dlt_rs::{DltApplication, DltId, DltLogLevel};
// Register application (one per process)
let app = DltApplication::register(&DltId::new(b"MBTI")?, "Measurement & Bus Trace Interface")?;
let ctx = app.create_context(&DltId::new(b"MEAS")?, "Measurement Context")?;
// Simple logging
ctx.log(DltLogLevel::Info, "Hello DLT!")?;
// Structured logging with typed fields
let mut writer = ctx.log_write_start(DltLogLevel::Info)?;
writer.write_string("Temperature:")?
.write_float32(87.5)?
.write_string("°C")?;
writer.finish()?;§Core Types
DltApplication- Application registrationDltContextHandle- Context for logging with specific IDDltLogWriter- Builder for structured multi-field messagesDltLogLevel- Log severity (Fatal, Error, Warn, Info, Debug, Verbose)DltId- Type-safe 1-4 byte ASCII identifiers
§Features
- RAII cleanup - Automatic resource management
- Structured logging - Structured logging messages via
DltLogWriter - Dynamic control - Runtime log level changes via
DltContextHandle::register_log_level_changed_listener() - Thread-safe - All types are
Send + Sync
§Log Level Control
DLT log levels can be changed at runtime by the DLT daemon or other tools.
Applications can listen for log level changes.
See DltLogLevel for all available levels and LogLevelChangedEvent to listen for changes.
§See Also
Structs§
- DltApplication
- Singleton guard for DLT application registration
- DltContext
- DltContext
Data - DltContext
Handle - Safe wrapper around C DLT context with RAII semantics
- DltId
- A DLT identifier (Application ID or Context ID)
- DltLog
Writer - Builder for structured log messages with multiple typed fields
- LogLevel
Changed Event - Event sent when DLT log level or trace status changes
Enums§
- DltError
- Internal error types for Rust-side operations (not from libdlt)
- DltLog
Level - DLT log level
- DltSys
Error - DLT return value error types (from libdlt C library)
- DltTrace
Status - DLT trace status
Constants§
- DLT_
ID_ SIZE - DLT_
ID_ SIZE_ USIZE - Size of DLT ID fields (Application ID, Context ID) - re-exported from bindings as usize