Crate dlt_rs

Source
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

§Features

§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
DltContextData
DltContextHandle
Safe wrapper around C DLT context with RAII semantics
DltId
A DLT identifier (Application ID or Context ID)
DltLogWriter
Builder for structured log messages with multiple typed fields
LogLevelChangedEvent
Event sent when DLT log level or trace status changes

Enums§

DltError
Internal error types for Rust-side operations (not from libdlt)
DltLogLevel
DLT log level
DltSysError
DLT return value error types (from libdlt C library)
DltTraceStatus
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